Ruby on Rails 3 Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ on OSX – Stack Overflow

This error also shows up after upgrading Ubuntu versions. A quick fix was to uninstall and reinstall the mysql gem. Also ensure your database.yml file has proper connection credentials.


$> gem uninstall mysql2

Assuming mysql2 is in your Gemfile

$> bundle install

Ruby on Rails 3 Can't connect to local MySQL server through socket '/tmp/mysql.sock' on OSX – Stack Overflow.