问题
使用 mysqldump 备份时报错:
[root@mybox ~]# mysqldump -p --result-file=/tmp/dbbackup.sql --database myDBname
Enter password:
mysqldump: Got error: 145: Table './myDBname/myTable1' is marked as crashed and should be repaired when using LOCK TABLES解决方案一
检查表:
CHECK TABLE mytable1修复表:
REPAIR TABLE mytable1解决方案二
此方法经笔者验证成功
- 停止 MySQL 服务。
- 进入 MySQL 数据目录当前库下。
检查数据表文件,若有异常会显示,无异常则无输出(不输入
--silent则显示所有检查结果):[root@localhost interface]# myisamchk *.MYI --silent myisamchk: MyISAM file jk_court_judgment_simple_item.MYI myisamchk: warning: Table is marked as crashed myisamchk: error: Found 195 keys of 194 myisamchk: error: Recordlink that points outside datafile at 53148 MyISAM-table 'jk_court_judgment_simple_item.MYI' is corrupted Fix it using switch "-r" or "-o" myisamchk: MyISAM file jk_personal_investment_holder.MYI myisamchk: warning: Table is marked as crashed myisamchk: error: Found key at page 12288 that points to record outside datafile myisamchk: error: Recordlink that points outside datafile at 69472 MyISAM-table 'jk_personal_investment_holder.MYI' is corrupted Fix it using switch "-r" or "-o"修复:
-o尝试恢复-r强制恢复myisamchk *.MYI -o参数说明
-r, --recover Can fix almost anything except unique keys that aren't unique. -o, --safe-recover Uses old recovery method; Slower than '-r' but can handle a couple of cases where '-r' reports that it can't fix the data file. -s, --silent Only print errors. One can use two -s to make myisamchk very silent.
这篇文章还没有人留言,快来抢沙发吧。