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? Thank you for your help.

Answers


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


Need Your Help

How do I find out my MySQL URL, host, port and username?

java mysql database jdbc database-connection

I need to find my MySQL username. When I open the MySQL command line client, it only asks me for my password. I don't remember my username. And for connectivity with JDBC, I need the URL, host and ...

(Smooth)ScrollToPosition doesn't work properly with RecyclerView

android scroll android-recyclerview smooth-scrolling gridlayoutmanager

I'm using basic RecyclerView with GridLayoutManager. I observed that nor smoothScrollToPosition nor scrollToPosition works properly.