The best answers to the question “MySQL server startup error 'The server quit without updating PID file'” in the category Dev.
On Mac OS X v10.6 (Snow Leopard), starting MySQL gives the following error:
The server quit without updating PID file
[mysqld] port = 3306 socket = /tmp/mysql.sock skip-external-locking key_buffer_size = 16K pid-file=/var/run/mysqld/mysqld.pid [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
Follow the instructions from
brew install mysql.
Set up databases to run as your user account with:
For MySQL 5.x:
unset TMPDIR mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run mysqld, view the help for
And view the MySQL documentation:
- 4.4.3 mysql_install_db — Initialize MySQL Data Directory
- 2.10.4 Securing the Initial MySQL Accounts
For MySQL 8.x:
unset TMPDIR mysqld --initialize-insecure --log-error-verbosity --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Make sure the data directory
/usr/local/var/mysql above is empty. Back it up if necessary.
To run as, for instance, user “mysql”, you may need to
sudo mysql_install_db ...options...
Start mysqld manually with:
Note: if this fails, you probably forgot to run the first two steps up above
Try to find your log file with suffix “.err”. There should be more information. It might be in:
It’s probably a problem with permissions
Check if any MySQL instance is running
ps -ef | grep mysql
If yes, you should stop it, or kill the process:
kill -9 PID
PIDis the number displayed next to the username on the output of the previous command
Check ownership of
ls -laF /usr/local/var/mysql/
If it is owner by
root, you should change it to
sudo chown -R mysql /usr/local/var/mysql/
After rebooting I had the same issue. Here is how I fixed it:
sudo chown -R _mysql /usr/local/var/mysql
I had the same issue on my Mac machine (correctly followed all the installation steps suggested by
Deleting the error file fixed it for me:
sudo rm -rf /usr/local/var/mysql/dev.work.err (
dev.work is my hostname)
This worked because
dev.work.err was owned by
_mysql:wheel instead of my own username.
CHOWN-ing the error file would have probably fixed it as well.