mysql directx repair_Incorrect key file for table mysql表损坏的修复方法

今天查询mysql的时候,报这样的错误,Incorrect key file for table './tg/dxad.MYI'; try to repair it. mysql表损坏的情况是很少见的,下面的方法适用于myisam,其他存储引擎,不知道能不能这样修复。

1,myisamchk修改表

[root@localhost tg]# myisamchk -of ./dxad.MYI //修复第一步

- recovering (with keycache) MyISAM-table './dxad.MYI'

Data records: 12597637

Found block that points outside data file at 1630252996

Data records: 12597456

[root@localhost tg]# myisamchk -r ./dxad.MYI //修复第二步

- recovering (with sort) MyISAM-table './dxad.MYI'

Data records: 12597456

- Fixing index 1

[root@localhost tg]# myisamchk ./dxad.MYI //修复第三步

Checking MyISAM file: ./dxad.MYI

Data records: 12597456 Deleted blocks: 0

- check file-size

- check record delete-chain

- check key delete-chain

- check index reference

- check data record references index: 1

- check record links

myisamchk带的参数,可以用man看一下。操作后重新启动一下数据库。

[root@localhost tg]# /etc/init.d/mysqld restart

这样操作后,还是有问题,会报 #145 - Table "XXXXX" is marked as crashed and should be repaired。如下图:

1031bcda48b2c1c0069dd08639949eb7.png

myisamchk 修复表后报的错误

2,命令行下repair修复表

mysql> repair table dxad; //dxad是表名

如下图

00b9012fee16b89f86eee20d22fa5d3c.png

命令行下repair修复表成功

到这儿,myisam表损坏就修复好了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值