12.19.07
Merb on Cygwin: “No such file or directory - /tmp/mysql.sock” (resolved)
When trying to perform a migration (rake db:migrate) I hit the following error:
$ rake db:migrate (in /home/Robert/ruby/merb_apps/blog) svn: '.' is not a working copy Connecting to database... Thu, 20 Dec 2007 01:48:09 GMT: loading gem 'merb_activerecord' from config/dependencies.rb:16 ... rake aborted! No such file or directory - /tmp/mysql.sock (See full trace by running task with --trace)
After a few minutes of googling and some trial/error I discovered that changing “localhost” in the database.yml file to the loop back address 127.0.0.1 resolved the issue. Apparently when you specify an IP address the :socket: value is not needed. Since the default merb database.yml content includes the line:
:socket: /tmp/mysql.sock
This is something that other Windows users may need to modify.
This is my updated config/database.yml file:
:development: &defaults :adapter: mysql :database: blog_development :username: root :password: :host: 127.0.0.1 :test: <<: *defaults :database: blog_test :production: <<: *defaults :database: blog_production
David said,
January 14, 2008 at 2:43 pm
thanks for posting this! had the exact same issue. also trying to get up to speed on ruby on rails.
francisco said,
May 20, 2008 at 9:04 pm
I’ve been looking for a solution to this basically for 7 hours now. Thanks, this worked super. I’m installing redmine, one of the steps was:
$ rake db:migrate RAILS_ENV=”production”
SO i was getting that same error. Changed to loopback address and fixed..! Thanks