Can’t open and lock privilege tables: Table ./mysql/db is marked as crashed
On a Cpanel Server, MySQL did not start. I checked the error log in /var/lib/mysql folder, and found the following error in MySQL log file /var/log/mysqld.log
1 2 3 4 |
2023-03-10T18:13:26.405453Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/db' is marked as crashed and should be repaired 2023-03-10T18:13:26.405465Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/db' is marked as crashed and should be repaired 2023-03-10T18:13:26.405471Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files. 2023-03-10T18:13:26.405486Z 0 [ERROR] Aborting |
It says “db” table in “mysql” database got corrupted. To fix, I run following
1 2 |
cd /var/lib/mysql/mysql myisamchk -r db |
Now restart MySQL with the command
1 |
systemctl restart mysqld |
Back to MySQL Repair