如何修复损坏的表 [英] How to repair corrupted table
问题描述
我有一个名为 Sample 的mysql
表.我用一些值编辑了文件/var/lib/mysql/Sample.MYI
.现在检查TABLE示例查询显示为
表"Sample"的密钥文件不正确;尝试修复
要修复此问题,我尝试使用以下命令myisamchk -r Sample.MYI
.但结果是"myisamchk:
错误:由于错误,尝试重新创建索引文件MyISAM表
Sample.MYI
时出现错误140.
现在如何修理这张桌子?
以防万一,您没有备份,没有原始文件且无法重新下载,以下一些链接可能会为您提供帮助:>
http://www.felipecruz.com/repair-mysql-database.php
http://dev.mysql.com/doc/refman/5.0/en/myisam- repair.html (另请参阅此页面底部的链接)
http://forums.mysql.com/read.php?21,362974,362974
以下命令将从头开始重新创建.myi文件:
REPAIR TABLE tablename USE_FRM
请谨慎,此页面:http://dev.mysql.com/doc/refman/5.5/en/repair-table.html 说:
仅当您不能使用常规的REPAIR模式时才使用USE_FRM选项!告诉服务器忽略.MYI文件会使修复过程中无法使用.MYI中存储的重要表元数据,这可能产生有害后果:[.....]
最后是如何以不同方式重做此操作:
http://www-users.cs.york.ac.uk/susan /joke/foot.htm
I have the mysql
table called Sample. I have edited the file /var/lib/mysql/Sample.MYI
with some values. Now check TABLE Sample query shows as
Incorrect key file for table 'Sample'; try to repair it
To repair this, i have tried using the following command myisamchk -r Sample.MYI
. but the result is "myisamchk:
error: Got error 140 when trying to recreate indexfile MyISAM-table
Sample.MYI
is not fixed because of errors".
Now how to repair this table ?
Just in case you don't have backup, don't have the original file and cannot redownload it, here are some links that might help you:
http://www.felipecruz.com/repair-mysql-database.php
http://dev.mysql.com/doc/refman/5.0/en/myisam-repair.html (see also links at the bottom of this page)
http://forums.mysql.com/read.php?21,362974,362974
The following command will recreate .myi files from scratch:
REPAIR TABLE tablename USE_FRM
Be careful with this though, this page: http://dev.mysql.com/doc/refman/5.5/en/repair-table.html says:
Use the USE_FRM option only if you cannot use regular REPAIR modes! Telling the server to ignore the .MYI file makes important table metadata stored in the .MYI unavailable to the repair process, which can have deleterious consequences:[.....]
And finally how to redo this in different ways:
http://www-users.cs.york.ac.uk/susan/joke/foot.htm
这篇关于如何修复损坏的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!