MySQL错误不正确的密钥文件。myisamchk的维修工作正常,但桌子很快又坏了

MySQL错误不正确的密钥文件。myisamchk的维修工作正常,但桌子很快又坏了,mysql,myisam,Mysql,Myisam,我的第一个问题是stackoverflow,所以我希望我已经遵循了所有的指导原则 我有一个关于数字海洋水滴的MySql数据库网站 我发现mysql已经停止运行,并且在查找后发现损坏的表。用myisamchk-r修复后,我认为问题解决了。然而,它一直在发生。我在my.cnf中更改了innodb\u buffer\u pool\u size=20M,并且在阅读本文后在/dev/vda/上创建了一些可用空间 我在mysql/error.log中有这些错误 [ERROR] /usr/sbin/mysql

我的第一个问题是stackoverflow,所以我希望我已经遵循了所有的指导原则

我有一个关于数字海洋水滴的MySql数据库网站

我发现mysql已经停止运行,并且在查找后发现损坏的表。用
myisamchk-r
修复后,我认为问题解决了。然而,它一直在发生。我在my.cnf中更改了
innodb\u buffer\u pool\u size=20M,并且在阅读本文后在
/dev/vda/
上创建了一些可用空间

我在mysql/error.log中有这些错误

[ERROR] /usr/sbin/mysqld: Incorrect key file for table './websitename/wp_options.MYI'; try to repair it
[ERROR] Got an error from thread_id=178, /build/mysql-5.5-heGK82/mysql-5.5-5.5.55/storage/myisam/mi_update.c:226
[ERROR] MySQL thread id 178, OS thread handle 0x7f4544010700, query id 69124 localhost th3489075 Updating
当我在收到的损坏表上运行
myisamchk db_name.MYI

Checking MyISAM file: wp_options.MYI
Data records:     375   Deleted blocks:       0
myisamchk: warning: Table is marked as crashed
myisamchk: warning: 1 client is using or hasn't closed the table properly
- check file-size    
myisamchk: error: Size of datafile is: 1059228           Should be: 1059276
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check data record references index: 2
- check record links
myisamchk: error: Keypointers and record positions doesn't match
myisamchk: warning: Found        375 key parts. Should be: 377
MyISAM-table 'wp_options.MYI' is corrupted
Fix it using switch "-r" or "-o"
使用
myisamchk-r或-o
选项修复表似乎可以在报告没有问题后立即运行
myisamchk*.MYI
,但稍后返回上述错误

我有各种数据库备份,但不确定它们与当前的有多大不同

我了解警告
myisamchk:warning:1如果mysql正在运行,则客户端正在使用或未正确关闭表


当mysql停止时,
myisamchk*.MYI
报告所有正常,但mysql仍然崩溃

每当mysqld出现电源故障或其他突然终止时,MyISAM表可能会损坏。这是切换到InnoDB的重要原因,InnoDB在保护自身和重启时自动修复方面做得更好


同时,您可以尝试
优化表
,作为强制重建表的一种方式。这可能会丢失或不会丢失似乎丢失的数据,但它可能会在下次崩溃之前消除错误消息。

谢谢Rick,是的,我听说Innodb更健壮,这是未来需要记住的。我今天和一位同事聊天,他建议转储数据库并导入它。到目前为止,这是运行没有错误。我还将记住优化表方法。
Checking MyISAM file: wp_options.MYI
Data records:     375   Deleted blocks:       0
myisamchk: warning: Table is marked as crashed
myisamchk: warning: 1 client is using or hasn't closed the table properly
- check file-size    
myisamchk: error: Size of datafile is: 1059228           Should be: 1059276
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check data record references index: 2
- check record links
myisamchk: error: Keypointers and record positions doesn't match
myisamchk: warning: Found        375 key parts. Should be: 377
MyISAM-table 'wp_options.MYI' is corrupted
Fix it using switch "-r" or "-o"