MySQL "is marked as crashed and should be repaired"异常问题处理

Z先森 2021-05-18 PM 440℃ 0条

场景

用工具连MySQL跑数据的时候发现挂掉了,查看发现磁盘写满了,磁盘扩容后,重启mysql发现起不来,查看日志

2021-05-18T02:21:25.491074Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
2021-05-18T02:21:25.491101Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired
2021-05-18T02:21:25.491114Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2021-05-18T02:21:25.491142Z 0 [ERROR] Aborting

发现user表损坏了,找了一些资料,最后修复成功

方法

#3种方法,耗时从上至下越来越久,效果也更好
myisamchk --recover --quick /path/to/tblName
myisamchk --recover /path/to/tblName
myisamchk --safe-recover /path/to/tblName
#例
myisamchk --recover --quick /var/lib/mysql/mysql/user
标签: none

如无特殊说明,本博所有文章均为博主原创。

评论啦~