ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)The post will show how to solve the above error.

MySql-sql-join-multiple-database-tables-logo-490x196Steps

– Is mysql starting properly when you run /usr/local/bin/safe_mysqld?

If so:

Verify the /tmp/mysql.sock file exists.

If not do:

mysqld stop
touch /tmp/mysql.sock

// With old brew recipes
safe_mysqld restart
// With new brew recipes
mysqld_safe restart

**Note: If mysql does not start properly after that last line:

You may need to install the tables manually using /usr/local/bin/mysql_install_db, then restart mysql