dedecms织梦mysql数据表出错修复方法

2017-03-27 20:09:00 dedecms

在维护网站时,发表文章时提示,把数据保存到数据库附加表 `dede_addonarticle` 时出错,请把相关信息提交给DedeCms官方。Incorrect key file for table ‘.xxxxdede_addonarticle.MYI’; try to repair it。大意是保存到附件表出错,肯定是这个表出问题了。


马上备份数据表,寻找解决办法。由于平台是用一键安装安装的,没有安装phpmyadmin,如果有安装phpmyadmin,打开数据表后,有问题的数据表会自动提示修复。


一键安装包自带的mysql图形界面工具只能检查错误,不能修复。找了很多命令修复的,但都没有成功。无奈,只能做自带的命令工具想办法。首先找到mysqlcheck.exe,命令没搞明白。再运行myisamchk.exe。


>myisamchk dede_addonarticle.MYI


Checking MyISAM file: dede_addonarticle.MYI

Data records: 544 Deleted blocks: 1

myisamchk: warning: Table is marked as crashed

myisamchk: warning: 1 client is using or hasn't closed the table properly

- check file-size

- check record delete-chain

myisamchk: error: Record at pos: 4282556 is not remove-marked

myisamchk: error: record delete-link-chain corrupted

- check key delete-chain

- check index reference

- check data record references index: 1

myisamchk: error: Found 545 keys of 544

- check record links

myisamchk: error: got error: 175 when reading datafile at record: 544

MyISAM-table 'dede_addonarticle.MYI' is corrup

ted

Fix it using switch "-r" or "-o"


看到最后一句Fix it using switch “-r” or “-o”,立即加上”-r”参数再运行一次。

>myisamchk -r dede_addonarticle.MYI

- recovering (with sort) MyISAM-table 'dede_addonarticle.MYI'

Data records: 544

- Fixing index 1

Found link that points at 4282604 (outside data file) at 4282556

- Fixing index 2

OK,修复完毕,检查数据,继续发布测试,收工!