Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Taps Server Error: Mysql::Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I get this error whenever I try to push my local mysql to heroku postgres. It seems that mysql is misconfigured and that windows is highly unlikely to have a var/run directory. I can understand that I need to force mysql to connect over tcp and not through socket. I checked the tutorials but its kind of not helping me any more can anyone help me with this ? I am using windows 7.

share|improve this question
What triggers the MySQL connection? Is it done manually from the commandline or through a build-script? – pkhamre Mar 28 '12 at 7:25
actually i use wamp server locally. . . – joar Mar 28 '12 at 7:47
Can you explain what triggers the error message you posted? If I know what starts the MySQL connections, it will be easier to help you to configure it correctly. – pkhamre Mar 28 '12 at 7:49
okay actually i have my code done in php and in mysql(localhost) ,so when i try to push to heroku,the remote server cannot able to make a connection with the local mysql of mine since mysql connects through socket and hence the error msg.pity me if am still not able to answer your question – joar Mar 28 '12 at 7:58
What kind of application is this? If it has any property files you can probably define different MySQL connections for development and for production. – pkhamre Mar 28 '12 at 8:00

i think you have tried to shift you mysql.ini file from you linux machine to windows..or something like that... please check the location of your socket file in mysql.ini where it is located..i in mysql.inin file the path is /var/run/mysqld/mysqld.sock but on windows it fails to load that file.By default while installing mysql server you will get the socket path as '/tmp/mysql.sock '

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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