Rails Migrations and 'Can‘t connect to local MySQL

Rails Migrations and 'Can‘t connect to local MySQL

Posted by: edwin7767
Posted on: 2007-08-20 18:04:00

After I set up my Rails app on Dreamhost, I tried to perform a data base migration on the production database using the command:

rake db:migrate

but I got the following error:

'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

But this command line to run the MySQL interpreter works, proving that I actually can connect to the production database:

mysql -u <db-user> -p<db-pssword> -h <my-db-domain> <db-name> | no space after '-p'

I finally solved my problem after viewing a 19 Jan 2006 entry at http://tom.wilcoxen.org/ . A slightly updated version follows:

Tags: production databasemysql serverdreamhostmigrationsrakeinterpreterdata basemigration