Fix “MySQL server PID file could not be found” Error

By | January 21, 2017

Fix “MySQL server PID file could not be found” Error

Hello everyone, I have one problem of my MySQL database. I am getting an error in the database stated “MySQL server PID could not be found” and I have tried several process to fix it. Even I have tried to shutdown mysqladmin which also does not work. Finally I have to kill the process ID and I was lucky enough that my database is safe and it did not cause any issue. But still I am confused what to do and not getting any option to solve it. What to do, can anyone help me?

Well MySQL is one of the useful database which is used by many organization and it is a database software in the application world. It is used for many purpose and sometimes users has to work with its services and then restart the services for the changes which is made to see the effect. But while starting MySQL service, an error may occur which can disturb the entire database. The error states:

MySQL is running but PID file could not be found

This issue can be due to several unwanted things and even due to disk space, innodb corruption or may be disk inode.

Also Read: How to Fix MySQL Database Power Outage’ Error

Here the issue is with PID file and solution is mentioned:

SSH server as a root user

Then create a directory /var/run/mysql

mkdir /var/run/mysql

Now create a file named as mysqld.pid

touch mysqld.pid

Then change its ownership and group to mysql:mysql

chown mysql:mysql mysqld.pid

At last restart the MySQL service and no errors will be seen.

If you are not satisfied with this process then you have to completely kill the process Id. For that you have to follow the steps provided:

First check whether /tmp partition is full. This happens when MySQL cannot write the /tmp partition to create a lock file.

df -h

Even there is a possibility that the /tmp partition is cleared and MySQL server is looking for PID file there. Therefore just create a new PID file and again restart the server.

touch /tmp/mysql.sock
service mysqld restart

By doing this the status is checked, even sometimes you can get an error message like:

$ service mysqld status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

Well this may be an instance, just remove the lock file and then restart the server.

rm /var/lock/subsys/mysql
service mysqld restart

When this does not work then you have to kill the current MySQL process from server by below mentioned steps:

ps -aufx | grep mysql

With process ID you can get all process of MySQL. You need to kill PID for MySQL by the following command

kill -9 PID1 PD2…

At last restart MySQL service

service mysql restart

The above steps mentioned are the ways to repair the database from error and this should be followed properly. Even after using it if the error still occurs then you need to use third party tool to recover the database.

Don’t Miss: MYSQL rebuild index InnoDB table

Solution

When you follow the steps mentioned and still you come across the same issue then you need to use third party tool like MySQL file Repair Tool which is one of the best tool for repairing MySQL database. It completely works to fix any type of error in MySQL and recovers the entire database. This software can also save the retrieved information in Transact-SQL script which is fit for quick database recreation. And also it recovers table structure and data. It supports MySQL versions like 5.x, 4.x, 3.x, 2.x and 1.x and available for all modern platforms that includes windows 95/98/2000/XP/2003 server. It has the ability to repair password protected SQL files smoothly. And most importantly it is very user friendly.

downloadnow file buynow learn-more-button-orange

Steps to repair corrupted MySQL table

Step 1: Start with Stellar Phoenix Database Repair for MySQL . Software and you can see the main interface as shown below.

Step 2: Click on ‘Select’ button & then select ‘Repair corrupt database which is stored at default location of MySQL’ option to select your database from default location and then click.

Step 3: The left pane shows the preview of database and its component in a tree like structure after completing scanning process.

Step 4: After previewing your database, to start repair process click ‘Repair’ button in file menu on the main user interface. Stellar Phoenix Database Repair for MySQL dialog box appears. Click Yes.

Step 5: After successful completion of the process, a message box is displayed as ‘repair process finished successfully’. Click ‘OK’ to close the message box.

Step 6: If you want to select the database manually then select ‘Manual selection of database to repair’ option & then click browse. Browse the folder dialog box opens. Select the folder that contains database and click ‘OK’.