Snow Lep Serv. MySQL problem with Wordpress

Discussion in 'Mac OS X Server, Xserve, and Networking' started by Debbi, Nov 13, 2010.

  1. Debbi macrumors newbie

    Joined:
    Nov 13, 2010
    #1
    I've been researching the problem all day and need some help.

    WordPress can't connect to the MySQL DB.

    1) I installed MySQL via the package from MySQL.com (64-bit)
    2) /etc/my.cnf shows that socket is at /var/mysql/mysql.sock
    3) I check and there is no socket at /tmp/mysql.sock (does not exist)
    4) My php.ini file in /etc/php.ini has "msqli.default_socket = /var/mysql/mysql.sock

    I've tried to set wp-config.php to:

    define('DB_HOST', 'localhost');

    also tried:

    define('DB_HOST, 'localhost:/var/mysql/mysql.sock');

    When loading the wordpress site, I get the:

    Error establishing a database connection

    I confirmed the username, dbname and password with Querious

    Any ideas?
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Personally I'd advise installing MAMP for local development.
     
  3. xboxphanatic macrumors member

    Joined:
    Apr 29, 2010
    #3
    I just recently moved my wordpress install to Leopard server. I'm just using the built in mysql service that comes with the OS. For php I used this build which includes many of the more common modules.

    That setup seems to be working fine for me, but the MAMP install mentioned above might be a little easier to get going.
     
  4. Debbi thread starter macrumors newbie

    Joined:
    Nov 13, 2010
    #4
    Solved

    Okay, so there were 2 problems:

    1) I must have edited the wrong php.ini file. I found the command "php --ri mysql" which listed all the config settings for MySQL. I found that I was pointing to /tmp/mysql.sock instead of /var/mysql/mysql.sock. A quick edit to /etc/myphp.ini fixed this (changed /tmp in 2 locations to /var/mysql)

    2) Second problem. Password for my wordpress account wasn't correct in wp-config.php. I changed it to match and that fixed it all.

    So it was really user error. Snow Leopard and new MySQL installs put the socket at /var/mysql/mysql.sock instead of the old location of /tmp/mysql.sock (for some kind of security reasons). Both PHP and wordpress need to know about this to work properly. The real key was finding out about the "php --ri mysql" command, which quickly let me debug things.
     

Share This Page