+91 88 00 563434 [email protected] Blog open-book Knowledge Base

Find Solutions in Our Knowledge Base

How to Fix the Common MySQL Errors?

You are here:
Sharing is Caring

In this guide, we will discuss the most frequent MySQL problems that may occur on your server and the potential solutions. If you encounter the “error establishing a database connection” message for all your websites, log in to your server through SSH and check the status of the MySQL service. You can check the MySQL status by executing the following command:

# service mysql status

If MySQL is not running, execute the following command to start the MySQL service.

# service mysql start

Starting MySQL.. ERROR! The server terminated without updating the PID file (/var/lib/mysql/server.pid).

If you encounter the “ERROR! The server quit without updating the PID file” error again, try to identify all the currently running MySQL processes using the following command:

Then terminate all MySQL processes.

# ps -ef | grep mysql

Once you have identified the MySQL processes, terminate all of them

# Kill -9 PID

If the error persists, attempt to transfer the ib_log files to the /tmp folder and try to start the MySQL service.

# mv /var/lib/mysql/ib* /tmp

Then attempt to start the MySQL service.

# service mysql start

If you check the MySQL error log and find the following error, please follow the steps below.

Check the MySQL error log in /var/lib/mysql/

mysqld started

[ERROR] /usr/sbin/mysqld: Table ‘./mysql/user’ is marked as crashed and needs to be repaired

[ERROR] /usr/sbin/mysqld: Table ‘./mysql/user’ is marked as crashed and needs to be repaired

[ERROR] Fatal error: Can’t open and lock privilege tables: Table ‘./mysql/user’ is marked as crashed and needs to be repaired mysqld ended

First, try the following command.

# /scripts/mysqlup –force

If you encounter the same error, try starting MySQL using the following command.

# service MySQL start –skip-grant-tables

Then repair the corrupted table using the command.

# cd /var/lib/mysql/mysql

# mysqlcheck -r mysql user

mysql.user

warning: Number of rows changed from 1558 to 1556

status: OK

Now that it is repaired, restart mysql.

root@ [/var/lib/mysql/mysql]# service mysql stop

Shutting down MySQL [ OK ]

root@ [/var/lib/mysql/mysql]# service mysql start

Starting MySQL [ OK ]

You can also restart the MySQL service from WHM.

1) Log in to WHM.

2) Go to Restart Services.

3) You can restart the MySQL service by clicking the “SQL Server (MySQL)” icon.

If you require further assistance, please contact our support department.


Sharing is Caring

Leave a Comment

Table of Contents