背景:今天测试一个开机脚本,执行reboot之后,mysql的一个表无法访问了,报错“tableName is marked as crashed and should be repaired”,在网上搜了一下知道是这个表里的索引坏了,坏的原因是在读写表的时候意外断电导致的,恢复方式如下:
1、找到表的存储文件"tableName.MYI" 2、执行“myisamchk -c -r tableName.MYI” 3、登陆mysql,选择数据库,然后执行"repair table tabTest;"
此时该表就可以正常使用了
数据库索引损坏报“tableName is marked as crashed and should be repaired”解决方式