MYSQL is marked as crashed and should be repaired解决办法
问题分析
错误产生原因,有网友说是频繁查询和更新[数据表]表造成的索引错误,因为我的页面没有静态生成,而是动态页面,因此比较同意这种说法。还有说法为是MYSQL数据库因为某种原因而受到了损坏,如:数据库服务器突发性的断电、在提在数据库表提供服务时对表的原文件进行某种操作都有可能导致MYSQL数据库表被损坏而无法读取数据。总之就是因为某些不可测的问题造成表的损坏。
解决办法
修复如下在你的mysql/bin下面找到myisamchk
在命令行中输入:
代码如下 | 复制代码 |
myisamchk -c -r d:mysqldataabc.MYI |
即可:)
国外参考
myisamchk
/etc/init.d/mysql stopDann kann man sich mit dem Brachial-Tool ans Werk machen:
hist-web:/var/lib/mysql/wsu# myisamchk smt_stats.MYI
Checking MyISAM file: smt_stats.MYI
Data records: 139144 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed
- check file-size
myisamchk: error: Size of datafile is: 10473472 Should be: 10473480
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
myisamchk: error: Found 139145 keys of 139144
- check record links
myisamchk: error: Recordlink that points outside datafile at 10473420
MyISAM-table 'smt_stats.MYI' is corrupted
Fix it using switch "-r" or "-o"Ich tat, wie mir befohlen wurde:
hist-web:/var/lib/mysql/wsu# myisamchk -r smt_stats.MYI
- recovering (with sort) MyISAM-table 'smt_stats.MYI'
Data records: 139144
- Fixing index 1
Found block that points outside data file at 10473420Zur Sicherheit überprüfte ich die Tabelle erneut:
hist-web:/var/lib/mysql/wsu# myisamchk smt_stats.MYI
Checking MyISAM file: smt_stats.MYI
Data records: 139144 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 linksDa alles wieder rosig aussah, konnte man MySQL wieder hochfahren:
/etc/init.d/mysql start
补充:数据库,mysql教程