Symptom: MySQL PID File Not Found Error
When performing certain operations (such as adding an FTP account) in an LLSMP environment or similar scenarios, you may encounter the following error:
* MySQL manager or server PID file could not be found!
Starting MySQL
. * Manager of pid-file quit without updating file.
This indicates that the MySQL service manager cannot find or create its Process ID (PID) file, preventing the service from starting normally.
Root Cause Analysis
This error is typically caused by one of the following:
- MySQL process exists but PID file is not properly registered: The MySQL service might already be running, but its PID file (usually located in
/var/run/mysqld/or/var/lib/mysql/) has been accidentally deleted, corrupted, or has incorrect permissions. - Previous MySQL process did not exit cleanly: Improper shutdown, forced process termination, or a system crash can leave a stale PID file, preventing a new process from overwriting it.
- Insufficient disk space or permission issues: The MySQL service account (e.g., the
mysqluser) lacks write permissions to the PID file directory, or the disk is full.
Solution: Terminate Stale Process and Restart
If the issue is confirmed to be caused by a stale process, follow these steps:
Step 1: Check if a MySQL Process Already Exists
Use the following command to check for any running MySQL (mysqld) processes:
ps -A | grep mysql
If the output resembles the following, a MySQL process is running:
12475 ? 00:00:02 mysqld
Step 2: Terminate the Stale MySQL Process
Use the kill command to terminate the Process ID found in the previous step (e.g., 12475):
kill 12475
If the process does not terminate normally, use the force kill command:
kill -9 12475
Step 3: Restart the MySQL Service
After terminating the process, restart MySQL using the service management command:
/etc/init.d/mysql start
Or, for newer systems using systemd:
systemctl start mysql
Upon successful startup, you should see output similar to:
Starting MySQL
. *
Additional Troubleshooting and Prevention
- Check PID file directory permissions: Ensure the
/var/run/mysqld/directory exists and that the MySQL user has read/write permissions. - Check disk space: Use the
df -hcommand to ensure sufficient system disk space. - Check MySQL error logs: Examine
/var/log/mysql/error.logor/var/log/mysqld.logfor more detailed error information. - Perform regular maintenance: Avoid improper server shutdowns or forcibly killing database processes.
Following these steps will typically resolve MySQL startup failures caused by PID file issues.