[Solved-5 Solutions] MySql server startup error 'The server quit without updating PID file '
Error Description:
On Snow Leopard, starting MySQL gives the following error:
- The server quit without updating PID file
my.cnf
[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
click below button to copy the code. By - mysql tutorial - team
Solution 1:
try to find your log file with suffix ".err", there should be more info. It might be in:
/usr/local/var/mysql/your_computer_name.local.err
click below button to copy the code. By - mysql tutorial - team
It's probably problem with permissions
- check if any mysql instance is running
ps -ef | grep mysql
click below button to copy the code. By - mysql tutorial - team
if yes, you should stop it, or kill the process
kill -9 PID
click below button to copy the code. By - mysql tutorial - team
where PID is the number displayed next to username on output of previous command
- check ownership of /usr/local/var/mysql/
ls -laF /usr/local/var/mysql/
click below button to copy the code. By - mysql tutorial - team
if it is owner by root you should change it mysql or your_user
sudo chown -R mysql /usr/local/var/mysql/
click below button to copy the code. By - mysql tutorial - team
Solution 2:
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
click below button to copy the code. By - mysql tutorial - team
To set up base tables in another folder, or use a different user to run mysqld, view the help for mysqld_install_db
:
mysql_install_db --help
click below button to copy the code. By - mysql tutorial - team
- To run as, for instance, user "mysql", you may need to
sudo
:
sudo mysql_install_db ...options...
click below button to copy the code. By - mysql tutorial - team
- Start mysqld manually with:
mysql.server start
click below button to copy the code. By - mysql tutorial - team
Solution 3:
- Delete the error file and try again:
sudo rm -rf /usr/local/var/mysql/dev.work.err
click below button to copy the code. By - mysql tutorial - team
- (
dev.work
is my hostname) - This works because
dev.work.err
is owned by_mysql:wheel
instead of our own username. CHOWN-ing the error file would probably fix it as well.
Solution 4:
Try to fix by this:
sudo chown -R _mysql /usr/local/var/mysql
click below button to copy the code. By - mysql tutorial - team
Solution 5:
Check all of the MySQL processes running:
$ ps aux | grep mysql
click below button to copy the code. By - mysql tutorial - team
USER PID %CPU %MEM
_mysql 5970 0.0 0.4 ...
click below button to copy the code. By - mysql tutorial - team
- Then kill all the processes listed from the above command using the following:
$ sudo kill -9 [PID]
click below button to copy the code. By - mysql tutorial - team
- Replace [PID] with the individual PID from the list above, e.g. 5970.
- Do that for all of the lines you see with the first command.
Then you can startup your MySQL server again:Replace [PID] with the individual PID from the list above, e.g. 5970. Do that for all of the lines you see with the first command.
mysql.server start