Trying to set up Drush with in a local dev environment on Windows 7 and can't get MySQL properly configured. A test command I've been running via Cygwin, with the resulting error, is as follows:

$ drush sql-query "SELECT * FROM erg_node WHERE nid=3"
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I can run the same SQL statement in phpmyadmin and it works fine. I can run the same drush command with a remote site and it also works, so it seems like it must be related to how MySQL is configured with WAMP and Cygwin. When I check which mysql via Cygwin, I get back /usr/bin/mysql instead of the path for WAMP's mysql. But the WAMP mysql path is set in my system environment PATH variable, so it should be accessible.

I've tried changing my.ini to include host =, copied the my.ini file to /etc/my.cnf, and run chmod -R 755 /tmp/. I'm not sure if there's something else I need to do to ensure drush uses the WAMP mysql command? Any help would be appreciated. Thank you!


For anyone else with this problem, it was an issue with the PATH variable. I had to add the path to the version of mysql that I wanted to use (the WAMP version) to the beginning of my PATH variable in my .bash_profile. SO post regarding PATH variable in .bash_profile.


Look at this post, they are talking about MAMP but I think that the problem is the same...

  • WAMP doesn't have the same start and stop MySQL shell scripts, AFAIK (this is my first project using WAMP rather than XAMPP). The my.ini file already had socket = /tmp/mysql.sock declared. I'm not sure exactly how sockets work, but the mysql.sock file does not exist currently. I also tried creating a symlink, but that didn't work.
    – nkanderson
    Sep 17 '14 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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