No such file or directory – /tmp/mysql.sock

I spent 15 minutes recently trying to work out why I was getting this error when I was trying to run a migration on my production site:


[root@home current]# rake db:migrate VERSION=production
(in /u/apps/myequity/releases/20081206042650)
rake aborted!
No such file or directory - /tmp/mysql.sock
(See full trace by running task with --trace)

Do you see the problem? What if I show you the db:migrate help…


[root@home current]# rake -D db:migrate
(in /u/apps/myequity/releases/20081206042650)
rake db:migrate
    Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false.

So basically I was using VERSION rather than RAILS_ENV (which isn’t mentioned in the description) :( Things worked fine after issuing the correct line:


[root@home current]# rake db:migrate RAILS_ENV=production
(in /u/apps/myequity/releases/20081206042650)
[root@home current]# 

Comments are closed.