I installed MySQL using brew. Suddenly, after running mysql.start I get the following error:
jmeena@Js-MacBook-Pro /usr/local/var % mysql.server startStarting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Js-MacBook-Pro.local.pid).
In the logs, I would see:
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock
Solution 1: Change ownership of the MySQL folder
This solution is very popular on StackOverflow:
jmeena@Js-MacBook-Pro /usr/local/var % sudo chown -R _mysql:_mysql mysql
You can check which user has permission by running ls -la
and looking at the first few columns. The correct user is the _mysql or home user, not admin.
Solution 2: Change permissions of the MySQL folder
jmeena@Js-MacBook-Pro % sudo chmod 777 /usr/local/var/mysql
Solution 3: Change permissions of the MySQL folder
jmeena@Js-MacBook-Pro % sudo chmod 777 /usr/local/var/
Solution 4:
Check your config file. You can find the location of your config file by:
mysql --verbose --help | grep my.cnf