Getting frustrated with MySQL PID could not be found CentOS error?
This is a common problem that happens when we simply restart the MySQL server.
Also, the error is due to the existing PID doesn’t allow us to create a new PID.
At Bobcares, we often get requests to solve such MySQL errors as part of our Server Management Services.
Today, let’s analyze the causes and see how our Support Team fix it for our customers.
What is MySQL PID could not be found CentOS error?
Let’s first get an idea of the error as such. In any server, Process identifier, a PID is a unique number that identifies each running process. Every service running on the server will have a unique PID associated with it.
The MYSQL PID error occurs due to existing PID doesn’t allow to create new PID. So we kill the old PID and restart the MYSQL service. Usually, this error arises when we try to restart the MYSQL service.
Recently one of our customers contacted us with the MYSQL PID error. He tried to restart the MYSQL service and it returned the error as:
How we fix MySQL PID could not be found centos error?
So far, we discussed MySQL PID could not be found centos error. Now let’s see how our Support Engineers fix this error for our customers.
Solution 1
To fix this error Our Support Engineers follow the below steps.
Normally, the reason for the error is due to the existing PID not allowing us to create a new PID. So we kill the old PID and then start MySQL service.
1. Therefore, we first check the MySQL existing PID. So we use the below command.
ps -aufx | grep mysql
Normally, the sample result will appear like this,
[root@server ~]# ps -aufx | grep mysql
root 10075 0.0 0.0 61304 748 pts/0 S+ 00:31 0:00 \_ grep mysql
mysql 4745 0.0 0.0 65948 1312 ? S Mar13 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/cent.pid
mysql 3546 0.0 2.1 288868 85376 ? Sl Mar13 198:35 \_ /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/cent .err --pid-file=/var/lib/mysql/cent.pid
From this above result, we found two existing MYSQL PIDs. And follow the steps.
2. Next, we kill the process using the below command.
[root@server ~]# kill -9 4745
[root@server ~]# kill -9 3546
3. Then we start MySQL service.
[root@server ~]# /etc/init.d/mysqld start
Starting MySQL...... SUCCESS!
4. Next, we check the MySQL service Status.
[root@server ~]# /etc/init.d/mysqld status
SUCCESS! MySQL running (14346)
[root@server ~]#
The MySQL service has been restarted successfully
Solution 2
Sometimes, the 100% usage of a server partition also can cause an error. Here, we check for the /tmp partition is full or not. Also, this can happen when MySQL can’t write to the /tmp partition to create a lock file.
1. For that, we use the below command to check the storage of partition.
$ df -h
Also, in many cases, clearing the /tmp partition results in failure to fetch the MySQL PID file. So we just create the PID file and restart the service.
2. Therefore, we use the below command to create the PID file. After that, we restart the MYSQL service.
$ touch /tmp/mysql.sock
$ service mysqld restart
3. Next, we check the MYSQL status.
service mysqld status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
Similarly, when the error is with the lock file, we remove the lock file and restart the MYSQL service.
$rm /var/lock/subsys/mysql
$ service mysqld restart
4. Again, if we get an error like this:
$ service mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/mydomain.com.pid).
5. Then we check the log file:/var/lib/mysql/mydomain.com.err
$ tail /var/lib/mysql/mydomain.com.err
130506 14:44:07 mysqld_safe mysqld from pid file /var/lib/mysql/mydomain.com.pid ended
Here the error tells us that we have a compatibility problem with some of our tables and MySQL fails to start in safe mode.
6. Therefore, we change the way MySQL starts to work around this situation.
$ { echo “mysql_enable=\”YES\””; echo “mysql_args=\”–skip-grant-tables –skip-networking\””; } >> /etc/init/rc.conf
7. Again we start the MYSQL service successfully.
8. Then after, we try to upgrade the MYSQL service.
$ mysql_upgrade
[Need more assistance for MySQL PID could not be found CentOS error? We are available 24×7 to fix it for you.]
Conclusion
In short, the MySQL PID could not be found CentOS error occurs due to the existing PID not allowing us to create a new PID. Also, it is a common problem during the restart of the MYSQL server. Today, we saw how our Support Engineers fix this error.
0 Comments