The best solution seems to be from Marc Liyanage’s page: Note that it may not always be /usr/local/mysql(try using TAB completion after typing in mysql after /usr/local)
Why do I get the message
ERROR 2002: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
when I try to connect to the DB using the mysql command line client?
Most likely you didn’t start up the DB server. Try this:
sudo ./bin/mysqld_safe &
Then try to connect again.