Monthly Archives: May 2012

Rails 3: Can’t connect to MySQL server on ‘localhost’ (10061)

I’ve just faced up with some funny problem with Rails and setting up a connection to MySQL-database.
I am using the command prompt to export the schema of some database:

rake db:schema:dump

I am getting the output:

** Execute db:schema:dump
rake aborted!
Can’t connect to MySQL server on ‘localhost’ (10061)

I’ve found the solution for the problem: it is necessary to edit the config/database.yml file and changing the host property: use 127.0.0.1 instead of localhost.