When you try to start MySQL server from the terminal, you may get an error message as shown below:
$ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
.. ERROR!
The server quit without updating PID file (/usr/local/mysql/data/nts-mac.pid).
This tutorial will try to help you to fix the error above and start your MySQL server successfully.
Before you try to fix the error, please don’t forget to create a backup of your MySQL database before trying any of the suggested solutions below.
I’m not responsible for any loss of data as you try to fix this error.
Fix MySQL server quit without updating PID file by killing any running processes
The PID (process identification) file is used by MySQL server to store the process ID number. When you need to run MySQL related commands, the PID file is needed to execute the command properly.
For example, you use the PID file when you want to stop the MySQL server. This is why when you run the mysql.server stop
command when there’s no running MySQL instance, the response would be like this:
$ sudo /usr/local/mysql/support-files/mysql.server stop
ERROR! MySQL server PID file could not be found!
In the MySQL error above, the PID file could not be found because it has been deleted when MySQL server stops running previously.
Some common causes that cause the server to quit without updating the PID file are as follows:
- You upgraded your MySQL version to the latest version
- Your MySQL service didn’t stop properly the last time it was running
- There’s already a running
mysqld
process that’s using a different PID file name.
In my local MySQL server, the third case happens because I started MySQL server using the MySQL Preference Pane that comes bundled with MySQL server installation file for Mac:
When I started the server using the Preference Pane, MySQL generates a PID file named mysqld.local.pid
in the /usr/local/mysql/data/
folder.
When I tried to start the server again using the terminal, MySQL tries to find the nts-mac.pid
file, which is generated when MySQL is started from the terminal (nts-mac
is the name of my Mac computer)
The PID file name mismatch causes MySQL to respond with “the server quit without updating PID file” above.
To fix the error, I needed to stop the currently running MySQL thread from the Preferences Pane before running the mysql.server start
command again.
Now you may not be using MySQL Preferences Pane, but it’s possible that you have a MySQL process running in your computer or Linux server that uses a different PID file name than the one generated by the terminal.
To check if there are running MySQL processes in your computer, you can run the ps -e | grep mysql
command from your terminal.
Here’s the output from my computer:
$ ps -e | grep mysql
24836 ttys001 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe
24920 ttys001 0:01.04 /usr/local/mysql/bin/mysqld
24946 ttys001 0:00.01 grep mysql
The result tells me that there are running mysqld
processes on my computer. If you found the same in your computer, then you need to kill the running process using one by one using the kill -9 <PID>
command.
The PID code number is the first number on the left, so in my case, they are 24836
and 24920
:
$ kill -9 24836
$ kill -9 24920
With that, there should be no running MySQL process on your computer. You can now try to start the MySQL server again:
$ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
SUCCESS!
Now the MySQL server should be able to start and run properly.
Fix MySQL server by changing the ownership of MySQL data directory
When you install MySQL server on your computer or server, the data/
directory is generated by the installer to store your data, including the PID file.
The data
directory must be owned by _mysql
in order for MySQL instance to work properly, so one possible cause of the PID file not updated error is that the data/
directory somehow got owned by a different user.
You can check this by running the ls -la
command from the terminal to check the owner of the files in your mysql/
directory:
Here’s the result from my computer:
drwxr-xr-x 13 root wheel 416 Aug 15 21:34 .
drwxr-xr-x 20 root wheel 640 Aug 15 21:34 ..
-rw-r--r-- 1 root wheel 276551 Jul 1 14:53 LICENSE
-rw-r--r-- 1 root wheel 666 Jul 1 14:53 README
drwxr-xr-x 35 root wheel 1120 Aug 15 21:34 bin
drwxr-x--- 59 _mysql _mysql 1888 Sep 4 18:03 data
drwxr-xr-x 5 root wheel 160 Jul 1 16:42 docs
drwxr-xr-x 16 root wheel 512 Jul 1 16:42 include
drwxr-x--- 3 _mysql _mysql 96 Sep 4 18:02 keyring
drwxr-xr-x 17 root wheel 544 Aug 15 21:34 lib
drwxr-xr-x 4 root wheel 128 Jul 1 16:42 man
drwxr-xr-x 34 root wheel 1088 Jul 1 16:42 share
drwxr-xr-x 5 root wheel 160 Jul 1 16:42 support-files
If you have another owner than _mysql
for the data/
directory, then you need to run the chown
command to change the owner of the directory.
The following command will change the owner of the data/
directory along with all files and subdirectories below it:
sudo chown -R _mysql:_mysql /usr/local/mysql/data
Next, run the ls -la
again and you should see the data/
directory owner got changed to _msql
in the terminal output.
You can try to run the MySQL server again now.
Fix MySQL server quit by reinstalling the server
If the solutions above fail, then I can only recommend you to try and reinstall MySQL server on your computer.
When installing MySQL server, please use the official installation file provided by mysql.com.
While you may want to install the server from package managers like Homebrew, Chocolatey, or any other Linux package repository, the installation from these third-party providers may cause unnecessary problems like wrong files or folders owner assignments.
If you don’t want to reinstall the server yet, then you may find other suggestions in StackOverflow. I only write what works for me in this tutorial.
And those are my suggestions for fixing the server quit without updating PID file error in MySQL database server. Good luck fixing the error! 👍
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.
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.
Im on CentOs v5.6 .When trying to start mysql im getting the following error
Starting MySQL. ERROR! Manager of pid-file quit without updating file.
In /var/log/mysqld.error.log i have the following
130319 03:39:04 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130319 3:39:04 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
130319 3:39:04 [Warning] '--log' is deprecated and will be removed in a future release. Please use ''--general_log'/'--general_log_file'' instead.
130319 3:39:04 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
130319 3:39:04 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
130319 3:39:04 InnoDB: Initializing buffer pool, size = 8.0M
130319 3:39:04 InnoDB: Completed initialization of buffer pool
130319 3:39:04 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
130319 03:39:04 mysqld_safe mysqld from pid file /var/lib/mysql/ip-10-144-82-28.pid ended
Please Help
Thank You
asked Mar 19, 2013 at 7:43
1
Looking at the logs it appears like file permission issue —
«the error means mysqld does not have the access rights to the
directory»
Check ownership of var/lib/mysql directory:
ls -ld /var/lib/mysql
drwxr-xr-x 8 mysql mysql 4096 Dec 11 12:34 /var/lib/mysql
Output MUST show «mysql mysql» ownership and atleast «drwxr-xr-x» (755) permission
If permissions are not correct, grant it:
chown mysql.mysql /var/lib/mysql
chmod 755 /var/lib/mysql
Then,
Uninstall RPM (Only when it is fresh installation, and you do not have any mysql data. If it is not fresh installation, do a rpm -Uvh instead)
Remove all contents of /var/lib/mysql/ directory Re-install RPM
check if /var/lib/mysql/mysql/plugin.frm is created after installing RPM
Then give a service mysql start and watch logs.
answered Mar 19, 2013 at 8:33
friendyogifriendyogi
391 gold badge1 silver badge4 bronze badges
/usr/sbin/mysqld: Can’t find file: ‘./mysql/plugin.frm’ (errno: 13)
130319 3:39:04 [ERROR] Can’t open the mysql.plugin table. Please run mysql_upgrade to create it.
make sure all your «mysql» db files are in /var/lib/mysql/mysql/ … or just run mysql_upgrade -p[password]
130319 3:39:04 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: ‘open’.
as stated earlier, mysql cannot write to the /var/lib/mysql/ibdata1 file.
make sure the user mysql is running as can write there.
answered Nov 16, 2013 at 17:20
nandoPnandoP
2,00114 silver badges15 bronze badges
If this is a Centos / RHEL or another distribution with selinux enabled that might be the culprit.
If that is the case disable selinux temporarily and see if it works.
echo 0 > /selinux/enforce
If SElinux is the problem, then you should monitor audit.log and make it work (check: MySQL 5.6 and SELinux are arguing)
You can also disable it permanently at /etc/sysconfig/selinux changing enforcing to either permissive or disabled.
answered Dec 18, 2013 at 14:56
WRITE FOR US