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!