Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Yesterday I was using Migration Assistant to move my data from my old Macbook Air to my new Macbook Pro. I assumed Migration Assistant can do a perfect job. However when I ran my rails server, it showed “Mysql2::Error: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”. So I googled for a few answers, finally fixed it by using tips from this one. Basically it looks like after the profile migration on my Mac, I lost some folder permissions using by Homebrew: http://stackoverflow.com/questions/16432071/how-to-fix-homebrew-permissions Simply, the solution is to type this command in your terminal:
sudo chown -R “$USER”:admin /usr/local
then I ran a update on my brew:
brew update
Everything is back to normal :)