How to fix [ERROR] /usr/sbin/mysqld: Table '/mysql/user' is marked as crashed and should be repaired

If MySQL is crashed and you check the MySQL logs:-

tail -f /var/log/mysqld.log

[ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
[ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired
[ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
[ERROR] Aborting

The MySQL service won't start.

To fix this:-

nano /etc/my.cnf

add at the bottom

skip-grant-tables

Restart MySQL service

service mysqld restart

This should start the MySQL service, however, you will still see crashed messages when you run:-

tail -f /var/log/mysqld.log

/usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired

To fix, repair the crashed tables

mysqlcheck -r --databases mysql --use-frm

Restart MySQL service
service mysqld restart

Now, the MySQL service should be started and the log should not show errors.

tail -f /var/log/mysqld.log

The last step, remove the entry from my.cnf

nano /etc/my.cnf
Remove skip-grant-tables entry

Restart MySQL service

service mysqld restart

Was this answer helpful? 4 Users Found This Useful (146 Votes)