I have an odd problem I'm hoping the group can help with. The problem is this:

  • I have a few situations where I load the Wordpress environment without the overhead of the GUI (details)
  • I am able to do this in most environments without a problem but a few (two laptops to be precise) refuse to load Wordpress and instead give me the following error:

enter image description here

What's so very strange is that:

  1. The db connection attributes are correct. This has been validated both by logging in manually from the command-line (using the credentials in the wp-config file); not to mention that this same wp-config.php has no problem loading the database when it is loaded normally by Wordpress.
  2. The files, OS, PHP version, even the DB connection parameters are all exactly the same on computers that work versus those that don't.

I'm not sure were else to look. Any help would be greatly appreciated.

  • Maybe your Mysql user got different "host" settings than your remote install? You should check if the Mysql user is allowing connections from localhost, or *
    – birgire
    Feb 12, 2013 at 1:48
  • I used the host/database/username/password from the wp-config.php file on the command line and it connected fine. Also the wp-config.php works fine when run via Wordpress screens.
    – ken
    Feb 12, 2013 at 23:43

1 Answer 1


I accidentally stumbled into the answer today when I forgot to turn on my MAMP managed mysql server. At this juncture it pointed me to the critical difference. This answer is phrased for anyone running MAMP but potentially has broader applicability (certainly LAMP, WAMP, etc.); if you're experiencing the same problem in an non-MAMP environment than these steps may still apply but the explicit directories would not:

  • When Wordpress loads normally it looks in /Applications/MAMP/tmp/mysql/mysql.sock but when run from the command line it instead looks for the socket file in /var/mysql/mysql.sock.
  • In order to allow for both execution environments (aka, normal WP and my command-line "include") you just need to create a symbolic link:

    ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

  • You may need superuser privileges, in which case just add sudo:

    sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.