The error ‘MySQL is not running’ in cPanel is one of the common error that we come across. Yes, we do understand this to be very annoying.
Generally, this error causes if MySQL is not stopped properly. This means when a systemd sends a command for the MySQL to start, the MySQL launches, and then it populates a lock for the subsystem. But then it stops with an error.
Here at Bobcares, we often receive requests to resolve the MySQL errors as a part of our Server Management Services for web hosts and online service providers.
Today, let us see how efficiently our Support Engineers fix this MySQL error.
How we fix MySQL is not running problem?
Now, let us see how our Support Engineers fix this error in cPanel.
1. Removing the lock file to fix MySQL error
One of our customers approached telling us that MySQL was not working well.
Our Support Engineers started to troubleshoot the error by checking the MySQL status using the below command
# service mysql status
MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
Copy Code
And the above was the status of MySQL telling us that MySQL was not running. So our Support Engineers ran the below command to remove the lock file.
rm /var/lock/subsys/mysql
Copy Code
Then, we restarted the MySQL service using the below command:
# service mysqld restart
Copy Code
This fixed the error.
2. MySQL stops running if tables crash
Another reason for this error to occur is due to the database tables crashing. Normally, the below message displays in the MySQL error logs.
MyISAM-table '/var/lib/mysql/dbname/table_name.MYI' is marked as crashed and should be repaired
Copy Code
We can fix this problem by repairing the database and the database tables using the below commands:
# myisamchk <database> <server>
# mysqlcheck -r <database> <postname>
Copy Code
Then, we restart the MySQL service using the command.
# service mysqld restart
Copy Code
[Need any further assistance in fixing MySQL error? – We’ll help you]
Conclusion
In short, this MySQL error occurs due to many reasons that include stopping MySQL improperly, tables crashing and so on. Today, we saw how our Support Engineers fix this MySQL error.
0 Comments