Friday 8 April 2011

Can't connect to local MySQL server through socket mysql.sock

You may be getting this error after an update or install or mysql server.

there are lots of different suggestions on how to fix this on the web, most of them will not work.. what will work is killing the mysqld process then restarting it..

to do this, do the following:

ps -A

this will list all processes, find the id of any mysql processes, then in shell type:

kill 11514 (where 11514 is ps id)

run ps -A again and check there is no mention of mysql anywhere..

now run "service mysqld start"

this should start mysql and create the mysql.sock file you had issues with earlier..

hope it fixed it for you,

Paul

Tuesday 5 April 2011

Rake create and migrate test databases

here is your answer:

rake environment RAILS_ENV=test db:create

rake environment RAILS_ENV=test db:migrate

cheers,

Paul