Pavel
Pavel

Reputation: 1974

Rails: can't migrate database

When I'm trying migrate database with bundle exec rake db:migrate I get an error Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). How can I fix it?

Upvotes: 0

Views: 85

Answers (1)

thorsten müller
thorsten müller

Reputation: 5661

There may be different reasons. Either as vanda says your mysql server simply isn't running.

Or it placed the mysql.sock file in a different folder. In this case you can add the following line to config/database.yml:

socket: /var/run/mysqld/mysqld.sock

(Obviously the path must be the right one, this may differ between installs and you may have to find the right path first)

Upvotes: 3

Related Questions