网站首页学无止境MySQL
mysql出现“Incorrect key file for table”解决办法
发布时间:2015-01-19 23:00:27编辑:songlin阅读(1043)
- mysql> select * from test;
- ERROR 1034 (HY000): Incorrect key file for table ‘test’; try to repair it
- mysql> repair table test;
- +—————+——–+———-+———————————————————+
- | Table | Op | Msg_type | Msg_text |
- +—————+——–+———-+———————————————————+
- | test.test | repair | Error | Incorrect key file for table ‘test’; try to repair it |
- | test.test | repair | error | Corrupt
- mysql> repair table test USE_FRM;
- +—————+——–+———-+———————————————————+
- | Table | Op | Msg_type | Msg_text |
- +—————+——–+———-+———————————————————+
- | test.test | repair | Error |Number of rows changed from 0 to 110423 |
- | test.test | repair | status | OK
- myisamchk -of /alidata/service/mysql/data/test.MYI
- myisamchk -r /alidata/service/mysql/data/test.MYI
- myisamchk safe-recover /alidata/service/mysql/data/test.MYI
- myisamchk -of /alidata/service/mysql/data/*.MYI
- myisamchk -r /alidata/service/mysql/data/*.MYI
- myisamchk safe-recover /alidata/service/mysql/data/*.MYI
最近在把一个网站从window服务器移到linux服务器上,由于是把mysql 里面的数据直接copy过来的 结果问题来了:Incorrect key file for table。
首先通过repair table修复:
如果还是没用,运行下面命令
按理应该可以了。
如果还是没用,则退出mysql,执行如下修复动作:
再重启mysql后应该可以正常了。
当然如果你和我一样是所有表都是这个问题 那就用“*”来代替表明