Fixing ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
I had a crash after a reboot, then MySQL would not run, the error I was getting was:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I tried to kill the PID which is what most posts recommend, but the error remained
This command did the trick for me, my installed MySQL version is just mysql if you're is like email@example.com then adjust the name on the end of the command.
sudo chown -R _mysql:mysql /usr/local/var/mysql && sudo brew services restart mysql
Thank you to the StackOverflow user FooBar
Another approach is to change MySQL Permissions:
sudo chown -R _mysql:mysql /usr/local/var/mysql
Then start MySQL
sudo mysql.server start