Saturday, February 21, 2015

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Mac OS 10.9.5

I was able to connect to the server using SQL Pro but not from the command line. The solution:

$ mysql -h 127.0.0.1 -P 3306 -u root -p

You can also use telnet to check the connectivity:

$telnet 127.0.0.1 3306
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
J
5.6.21 81/8j0O?Am$fZn<||}~!mysql_native_password

!#08S01Got packets out of orderConnection closed by foreign host.