mysql表损坏修复:table xxx is marked as crashed and last (automatic?) repair failed

修复方法:

先停止mysql服务:sudo service mysql stop

在命令行下进入损坏的库目录:cd /var/lib/mysql/$DATABASE_NAME

如果只是索引损坏则运行:myisamchk -c -r tablename.MYI 修复

上述命令修复不成功则使用:myisamchk -r -v -f --sort_buffer_size=2G <table_name> ,sort_buffer_size 大于表索引大小较好

也可以试试:repair table <table_name>;

 

分区的表也是同样使用 

myisamchk -c -r table#P#p1.MYI