How to Solve Error: MySQL Error Server PID File Could Not Be Found
In this article, we will look into the ERROR! MySQL server PID file could not be found!
in MySQL, and its solutions with a sufficient explanation.
MySQL PID File
A file contains the process identification number or process ID of the running instance of MySQL, known as MySQL PID File. Whenever we use the mysql.server
command, MySQL uses the PID file to find the process ID
.
MySQL server generates the PID file automatically whenever the Server is started. The MySQL server finds the process ID
from the PID file to stop the right MySQL process.
If the PID file of MySQL does not exist, the server shows ERROR! MySQL server PID file could not be found!
.
Fix MySQL ERROR! MySQL server PID file could not be found!
in Linux
We can face ERROR! MySQL server PID file could not be found!
error if the MySQL process exits or gets killed abruptly. We can fix this error using the following steps.
-
Check the path of PID file in MySQL configuration file located either at
/etc/mysql/my.cnf
or at/etc/mysql/mysql.conf.d/mysqld.cnf
.If the
pid-file
parameter is not set in the configuration file, set thepid-file
path by adding the following line.pid-file = /var/run/mysqld/mysqld.pid
-
Create the following directories and set the permission as follows.
mkdir /var/run/mysqld touch /var/run/mysqld/mysqld.pid chown -R mysql:mysql /var/run/mysqld
-
Change the ownership on the
MySQL
directory and set permission using the following command.sudo chown -R _mysql:_mysql mysql sudo chmod 777 /usr/local/var/mysql