MySQL/Mariadb - Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and last (automatic?) repair failed

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

MySQL/Mariadb - Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and last (automatic?) repair failed

Ошибка при старте MySQL сервера:

2020-11-03 14:10:41 0 [ERROR] mysqld: Table './mysql/user' is marked as crashed and last (automatic?) repair failed
2020-11-03 14:10:41 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and last (automatic?) repair failed

сообщает нам о том, что системная таблица mysql/user - повреждена и ее нужно восстановить. Решается просто через mysqlcheck -r после перевода сервера в безопасный режим работы:

# mysqld_safe --skip-grant-tables &
# mysqlcheck -r -A
# killall -9 mysql mysqld mysqld_safe
# systemctl restart mysql