user1072337
user1072337

Reputation: 12945

Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I am trying to perform a migration in Ruby on Rails 4, and I am running into the following error:

********-C02MGBVJFD57:myapp michaelsutyak$ bundle exec rake db:migrate
rake aborted!
Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Any ideas why this is happening?

Upvotes: 3

Views: 8960

Answers (1)

CGDS
CGDS

Reputation: 221

First verify that you have indeed run mysql.server start, as tmp/mysql.sock is generated on startup (as is tradition). If you are still encountering difficulties, run mysqladmin variables | grep socket and update the information in your database.yml accordingly

Upvotes: 22

Related Questions