Reputation: 101
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.
Upvotes: 0
Views: 99
Reputation: 101
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
Upvotes: 3