0

I was deploying a Rails application with mysql on Ubuntu, when I run rake db:migrate, I got the error Can't connect to local MySQL server through socket '/tmp/mysql.sock'.

By the way, I installed mysql by apt-get.

1 Answer 1

3

I got the answer on this page http://www.davideisinger.com/article/getting-started-with-ubuntu

This last step is just for Ruby on Rails. For whatever reason, Ubuntu puts the mysql.sock file in a different place than most Linux distros, confusing Rails. In order to point it to the correct place, create the following symlink:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

because your default database.yml in your application wrote this socket: /tmp/mysql.sock

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.