简体   繁体   English

mysqlcheck 不会修复表 (errno: 2)

[英]mysqlcheck won't repair tables (errno: 2)

I'm trying to repair some corrupted tables throught mysqlcheck command, but it returns the following "errno 2" error:我正在尝试通过 mysqlcheck 命令修复一些损坏的表,但它返回以下“errno 2”错误:

# mysqlcheck -u user -p --repair database
Enter password:
database.users                                OK
database.notes
Error    : Can't find file: 'notes' (errno: 2)
status   : Operation failed
...

I don't even need the information that was stored in that tables I can't repair, if only I could repair the tables without information it would be fine.我什至不需要存储在我无法修复的表中的信息,只要我可以修复没有信息的表就可以了。

Do you happen to know if is there any way to repair the corrupted tables?您是否碰巧知道是否有任何方法可以修复损坏的表?

Worked for me:为我工作:

Stop MySQL to free memory and get MySQL run memory parameter to put in the repair command:停止 MySQL 以释放 memory 并获取 MySQL 运行 memory 参数放入修复命令:

myisamchk --sort_buffer_size=20M --key_buffer_size=5G --read_buffer_size=8M --write_buffer_size=8M -t DIR_WITH_SPACE -r PATH_TO_TABLE.MYI

DIR_WITH_SPACE has to store tmp file as big as MYI table file. DIR_WITH_SPACE必须存储与 MYI 表文件一样大的 tmp 文件。 If you don't specify it, it'll use the system tmp, beware of reaching full.如果你不指定它,它将使用系统 tmp,小心达到满。

PATH_TO_TABLE.MYI is the MYI file of your table, in the MySQL data dir or elsewhere read/write place. PATH_TO_TABLE.MYI是表的 MYI 文件,位于 MySQL 数据目录或其他读/写位置。

Then the mysqlcheck should be useless and table usable.那么 mysqlcheck 应该是无用的并且表可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM