How to fix the MySQL server PID file could not be found error
The MySql server PID file could not be found error occurs when MySQL cannot find the PID file. It may also occur if the MySQL process is killed abruptly. Since the process does not end properly, the PID file is mismatched.
Solution
Step 1. Check for the parameter PID-file and create /var/run/mysqld/
Check where your PID-file points to. You can do this by running:
my.cnf
If the parameter is not present, set it as shown below:
pid-file = /var/run/mysqld/mysqld.pid
Next, create the following directory and give it the appropriate permissions, as follows:
mkdir /var/run/mysqld
touch /var/run/mysqld/mysqld.pid
chown -R mysql:mysql /var/run/mysqld
Step 2. Change ownership of the MySQL folder
Change the ownership of the MySQL folder:
sudo chown -R _mysql:_mysql mysql
Step 3. Change permissions of the MySQL folder
You can change the permissions of the MySQL folder by typing:
sudo chmod 777 /usr/local/var/mysql
Change permissions of /usr/local/var
If the above solutions do not work, try changing the permissions of /usr/local/var by typing:
sudo chmod 777 /usr/local/var
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved