MySQL 检查崩溃的表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9111857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL check for crashed table
提问by Adrien Hingert
I notice that when phpMyAdmin opens a DB it shows immediately if a table has crashed or not. It thus seems to me that phpMyAdmin is not running a CHECK TABLE
or ANALYZE TABLE
.
我注意到当 phpMyAdmin 打开一个数据库时,它会立即显示表是否崩溃。因此在我看来 phpMyAdmin 没有运行CHECK TABLE
或ANALYZE TABLE
.
Does anybody know what it does to obtain this informaiton so quickly and efficiently?
有人知道如何快速有效地获取这些信息吗?
回答by Martin.
回答by Soap Hope
show table status where comment like '%crash%';
回答by jeff-h
The most efficient way I have found is to use the commandline mysqlcheck
tool:
我发现的最有效的方法是使用命令行mysqlcheck
工具:
mysqlcheck -u mydbuser -p mydbname
mysqlcheck -u mydbuser -p mydbname
This will access mydbname
using user mydbuser
and prompting for that user's password. It will then check each table in the specified database.
这将mydbname
使用用户访问mydbuser
并提示输入该用户的密码。然后它将检查指定数据库中的每个表。
See https://dev.mysql.com/doc/refman/5.7/en/mysqlcheck.html
见https://dev.mysql.com/doc/refman/5.7/en/mysqlcheck.html
Note: this is not how phpMyAdmin does it, so this is not strictly an answer for the original question, but I'm putting this here because Google sends searches for mysql show crashed tables
here.
注意:这不是 phpMyAdmin 的做法,因此严格来说这不是原始问题的答案,但我将其放在这里是因为 Google 在这里发送搜索mysql show crashed tables
。
回答by Fedir RYKHTIK
If you have a shell access, the mysqlanalyze
utility could help.
如果您有 shell 访问权限,该mysqlanalyze
实用程序可能会有所帮助。
mysqlanalyze dbname