Ad Widget

Collapse

Test DB Connection failing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FABinNC
    Junior Member
    • May 2013
    • 6

    #1

    Test DB Connection failing

    I just installed Zabbix in Fedora 17. I have installed the database and confirmed that I can connect from the command line using user zabbix as well as root and another user I have created. However, on Step 4 of the installation GUI, I cannot get the Test Connection to work with any of these users.

    I am getting the error: mysql_connect(): can't connect to local MySQL server through socket '/usr/local/mysql/data/mysql.sock' (13) [include/db.inc.php:85]

    That is the socket I have configured in php.ini and my.cnf. The zabbix_server comes up fine without any issues. It is only this test in the installion UI that is having any sort of problem with MySQL.

    I have been suffering death by Google and can't find any answers to this problem. Any and all help is greatly appreciated!
  • tchjts1
    Senior Member
    • May 2008
    • 1605

    #2
    I leave the socket in its default location: /var/lib/mysql

    [root@:/var/lib/mysql]
    # ls -l
    total 20
    srwxrwxrwx. 1 mysql mysql 0 Mar 12 08:14 mysql.sock


    And then of course, I don't modify php.ini for anything regarding the socket:

    Code:
    ; Default socket name for local MySQL connects.  If empty, uses the built-in
    ; MySQL defaults.
    ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-socket
    mysql.default_socket =

    Comment

    • FABinNC
      Junior Member
      • May 2013
      • 6

      #3
      I don't think the socket location has anything to do with it. It is obviously using the correct location since it is spelled out in the error message and as I said, the zabbix server has no problem connecting whatsoever and I can connect fine via the commandline with three different users.

      I'll give it a try anyway, but any other ideas?

      Comment

      • FABinNC
        Junior Member
        • May 2013
        • 6

        #4
        [SOLVED]

        In an attempt to use /var/lib/mysql/mysql.sock as the default socket, I noticed I got the exact same error (i.e. with the old path in /usr/local/mysql). This lead me to discover that I was editing the wrong php.ini file.

        A word to the wise for Fedora installations: I am using Fedora 17 and the distribution comes with PHP already. It is probably a good idea to remove this with yum before downloading and recompiling PHP. That would have saved me a great deal of pain and confusion. Same goes for MySQL if you plan to download a more current version.

        Comment

        • nilie
          Junior Member
          • May 2013
          • 16

          #5
          Originally posted by FABinNC
          [SOLVED]

          ....
          A word to the wise for Fedora installations: I am using Fedora 17 and the distribution comes with PHP already. It is probably a good idea to remove this with yum before downloading and recompiling PHP. ....
          Being a good or a bad idea depends on what are your purposes. Removing applications that come with a distribution and replacing them with newer versions you compile from source has to be carefully considered otherwise you might get into two major kind of nasty problems:
          - dependency problems between components that might require the old version. You must not forget that if you compile and install PHP from source, the package manager will never know of its existence or version so if you try to install other applications that require PHP, the package manager might not be able to do it. From here on, you are on your own!
          - it makes updating the system more difficult than it should be.
          If you are looking at the maintainability in a production environment, there are a lot of reasons against doing this replacement.
          Are there any special circumstances in your view that could make compiling from source a better (or unique) alternative ?

          Comment

          Working...