How to Solve Error: MySQL Error Server PID File Could Not Be Found

Dr. Muhammad Abdullah Feb 02, 2024
  1. MySQL PID File
  2. Fix MySQL ERROR! MySQL server PID file could not be found! in Linux
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.

  1. 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 the pid-file path by adding the following line.

    pid-file = /var/run/mysqld/mysqld.pid
    
  2. 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
    
  3. 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
    

Related Article - MySQL Error