Macos mysql error the server quit without updating pid file

November, 2014: If you're getting this error on MySQL 5.6.x on Mac OS X Mavericks or Yosemite and want to use MySQL with PHP locally (/tmp/mysql.sock is where PHP PDO expects to find the sock file), here is what fixed it for me:

1) Uncomment the default homebrew config file lines and edit as below

$ sudo vi /usr/local/Cellar/mysql/5.6.21/my.cnf
...
basedir = /usr/local/Cellar/mysql/5.6.21
datadir = /usr/local/var/mysql
port = 3306
server_id = 
socket = /tmp/mysql.sock
pid-file = /usr/local/var/mysql/[BOXNAME].local.pid
....

BOXNAME is what you have in your System Prefs -> Network as the unique id for your computer on the network.

2) Set permissions on all the files in the mysql datadir. These were all owned by [my_username]. MySQL is very picky about this and refuses to create the pid file unless it (the user _mysql) owns the directory.

$ sudo chown -R _mysql:mysql /usr/local/var/mysql

3) Start MySQL using the bash helper/wrapper script:

$ sudo mysql.server start
Starting MySQL
. SUCCESS! 

Hope that helps. If the above doesn't work for you, try to run the mysqld_safe binary manually in the Cellar/mysql/VERSION_/bin/ directory and check what the settings are (if it runs)

sudo /usr/local/Cellar/mysql/5.6.12/bin/mysqld_safe &

If that runs, you can

ps aux | grep mysql 

and see something like

[username]  6881   0.0  2.7  3081392 454836   ??  S     8:52AM   0:00.54 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --verbose --log-error=/usr/local/var/mysql/BOXNAME.local.err --pid-file=/usr/local/var/mysql/BOXNAME.local.pid

I'm not sure why that worked for me but it shows you where I got the my.cnf config file options from. You can also use the command line options to try to troubleshoot when starting mysqld manually.

If you do run manage to run MySQL server using mysqld_safe, you may have to do this to shut it down before trying the mysql.server bash helper. Resist the urge to kill -9 [PID] because you can corrupt your data.

mysqladmin -uroot shutdown

Good luck!

I think the problem might be the PID file

There are two I can see

One in the directory

/usr/local/mysql/data/mysqld.local.pid

and one in the error message

/usr/local/mysql/data/Nicks-MacBook-Pro.local.pid

Please delete those two pid files if they still exist.

Then, start mysql and let’s us know what happens.

I have suggested this twice in the past, 4 years ago and 6 years ago

Before doing so, check to make mysqld is not running.

ps -ef | grep -v grep | grep mysqld

If you see mysqld still running, kill the process, then delete the pid files and retry starting mysql.

UPDATE 2021-01-29 15:56 EST

As it turns out, there were two installations of MySQL involved on the Mac as was learned in the Chat Session.

One installation was done as a dmg install; the other was a homebrew installation.

Once it was discovered that homebrew was competing with the dmg for the PID file, it was decided to stop using the dmg version and use the homebrew version via brew services approach.

The two installs were butting heads, having different PID files.

Server Quit Without Updating PID File. I am getting this error with my MySQL server. Please fix it asap!

That was a recent HelpDesk request we received in our Server Management Services.

This error occurs when MySQL upgraded to a later version.

Today, let’s check the error and see how our Support Engineers fix this for our customers.

When does MySQL Server Quit Without Updating PID File

Let’s begin by checking the typical scenario at which the error occurs.

This server quit without updating PID file error usually pops up when MySQL fails to start. This occurs after a recent MySQL upgrade or due to insufficient permission and ownership issues in the MySQL data directory.

In such cases, the PID file in the MySQL data directory goes missing and MySQL won’t work without it.

Recently one of our customers contacted us with the error server quit without updating PID file. When he tried to start the MySQL service it returned the error message.

Macos mysql error the server quit without updating pid file

How we fix Server Quit Without Updating PID File error in MySQL?

MySQL startup errors are quite common. Let’s see how our Support Engineers fix this error for our customers.

1. Restart the MySQL service to fix Server Quit Without Updating PID File.

To solve this error, we begin by restarting the MySQL service. Usually, it resolves this MySQL error.

To do this, we run this below command from the terminal.

We log into the server via SSH.

Then we run this command on the server terminal.

/etc/init.d/mysqld restart

Or

service mysqld restart

Then we check if the MySQL service is already running on the server

For this, we type the following command to determine if there is MySQL service running already.

ps -aux | grep mysql

If MySQL service is already running, we get the list of MySQL processes with PIDs. And then, we kill those processes.

kill -9 PID

// where PID is the process ID of the MySQL processes and restart the MySQL service again.

2. Remove Your MySQL Config File and start again.

Sometimes the modification of the MySQL configuration file also may cause this error. It can be the problem of using an unsupported variable, or something similar.

So the easiest way is to remove the conf file and restart the MYSQL again. The MySQL conf file is automatically rebuilt after the restart of MYSQL service.

1. First we backup the MySQL configuration file using the below command.

mv /etc/my.cnf /etc/my.cnf.backup

2. Then we restart the MYSQL service again.

And, MySQL starts with the following message:

    Starting MySQL. SUCCESS!

3. Check ownership of /var/lib/mysql/ directory

Often bad permissions of the MySQL directory can also end up in the error. Here, we check the ownership using:

ll -aF /var/lib/mysql/

If we find it’s the owner is root, then we change the ownership to MySQL using the below command.

chown -R mysql /var/lib/mysql/

4. Removing the error files

At times, the fix may also involve removing any .err files in the data folder or create missing .pid.

For this, we use the below command.

rm *.err /usr/local/mysql/data/

5. Check the MySQL error log file

In all scenarios, we check the MySQL log files to get more details about the error.

/var/lib/mysql/your_doamin_name.err

Or

/var/log/mysql/error.log

From these logs, we get pointers to the exact error and we proceed further.

6. Upgrade to latest MySQL version

Finally, when MySQL service is running in safe mode and displays invalid PID error, then we upgrade the service to latest version.

To ensure this, we first edit the /etc/rc.conf and put the following into the file:

mysql_enable="YES"
mysql_args="--skip-grant-tables --skip-networking"

Then we restart MySQL through rc.d:

/usr/local/etc/rc.d/mysql-server start

Starting MySQL.. SUCCESS!

Then we upgrade the MySQL to the latest version using the following command

mysql_upgrade

That completes the various ways by which we fix the MySQL error for our customers.

[Still having trouble in fixing Server Quit Without Updating PID File error in MySQL? We’ll fix it for you.]

Conclusion

In short, Server Quit Without Updating PID File error happens when MySQL fails to start due to insufficient permission and ownership issues in the MySQL data directory. Today, we saw how our Support Engineers sort out the MYSQL error for our customers.

How do I fix the server stopped without updating PID files?

How we fix Server Quit Without Updating PID File error in MySQL?.
Restart the MySQL service to fix Server Quit Without Updating PID File. ... .
Remove Your MySQL Config File and start again. ... .
Check ownership of /var/lib/mysql/ directory. ... .
Removing the error files. ... .
Check the MySQL error log file. ... .
Upgrade to latest MySQL version..

How do I fix the error MySQL server has gone away?

How do I fix the error “Mysql Server has gone away”?.
Server timed out and closed the connection. To fix, check that wait_timeout mysql variable in your my. ... .
You may also need to increase the innodb_log_file_size mysql variable in your my. ... .
Server dropped an incorrect or too large packet. ... .
Database server ran out of space..

What is PID file in MySQL?

The MySQL PID file is a process identification file that stores the Process ID number of the running MySQL instance. Each time you issue a command to mysql. server , MySQL would look for the PID file to find the Process ID and forward the command to the right process number.

How do I start MySQL server on Mac?

To enable the launchd service, you can either:.
Open macOS system preferences and select the MySQL preference panel, and then execute Start MySQL Server. ... .
Or, manually load the launchd file. ... .
To configure MySQL to automatically start at bootup, you can: $> sudo launchctl load -w com..