Configure Rails with MySQL under Ubuntu – Socket Problem

Posted on Mai 13, 2008

I am currently developing a Ruby on Rails (RoR) application under Ubuntu. I am using MySQL as the database and Netbeans 6.1 for developing. When I tried to access the database, I got following error:

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

Ok, pretty straight forward. Since in Ubuntu/Debian the mysql.sock is located at /var/run/mysqld/mysqld.sock, I added

socket: ‘/var/run/mysqld/mysqld.sock’ #ubuntu/debian

to the database.yml. Trying the new configuration, gave me a new error:

rake aborted!

EMULTIHOP (Reserved)

Nice, I couldn’t understand the error message, so I started googling. Not too many useful results, but I found a blog entry that says I should use 127.0.0.1 instead of localhost. So I changed

host: localhost to host: 127.0.0.1

and I deleted the unnecessary socket entry

socket: ‘/var/run/mysqld/mysqld.sock’ #ubuntu/debian

Everything worked and the Day was saved, ready to conquer Rails :) Happy coding!

Related posts:

  1. Routes in Rails 3
  2. Präsentation: Rails in the Large von Neil Ford
  3. Speed up your website with CDN and Rails
  4. JRuby finds a new home at Engine Yard
  5. ClassCastException in JRuby 1.1.2 – org.jruby.RubyArray cannot be cast to org.jruby.ast.ListNode

Tags: ,

One Response to “Configure Rails with MySQL under Ubuntu – Socket Problem”

  1. Eric
    Jun 26, 2009

    Thanks a million for posting that. You saved me a whole lot of time!



Leave a Reply

Subscribe