[MySQL] 怎样使用Mysqlcheck来检查和修复, 优化表
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了[MySQL] 怎样使用Mysqlcheck来检查和修复, 优化表,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3956字,纯文字阅读大概需要6分钟。
内容图文
newmandela 是库名, order是表名,还需要输入用户名和密码
检查一个库中的所有表
$ mysqlcheck -c newmandela -uroot -p
Enter password:
newmandela.account OK
newmandela.alarm OK
newmandela.alarm_settings OK
newmandela.auth_group OK
newmandela.auth_group_permissions OK
newmandela.auth_permission OK
...
检查所有库中的所有表
全部的库和表都检查一遍了。
$mysqlcheck -c --all-databases -uroot -p
Enter password:
apmonitor.acinfo OK
apmonitor.apdailysts OK
apmonitor.apinfo OK
apmonitor.apmonthsts OK
apmonitor.apscanlog OK
apmonitor.auth_group OK
...
如果只想检查某几个库呢? 可以使用 –databases 参数
$ mysqlcheck -c --databases newmandela radius -uroot -p
Enter password:
newmandela.account OK
newmandela.alarm OK
newmandela.alarm_settings OK
newmandela.auth_group OK
...
使用 mysqlcheck 分析表
$ mysqlcheck -a radius payment_transactionrecord -uroot -p
Enter password:
radius.payment_transactionrecord Table is already up to date
上面的命令 用来分析 radius 库的 payment_transactionrecord
表, -a
表示 analyze
使用 mysqlcheck 优化表
# mysqlcheck -o radius payment_transactionrecord -uroot -p
Enter password:
radius.payment_transactionrecord OK
-o
代表 optimize ,这里是优化 radius 库的 payment_transactionrecord
表
使用 mysqlcheck 修复表
# mysqlcheck -r radius payment_transactionrecord -uroot -p
Enter password:
radius.payment_transactionrecord OK
-r
代表 repair ,这里是 修复 radius 库的 payment_transactionrecord
表
检查,优化,修复表组合命令
# mysqlcheck -uroot -p --auto-repair -c -o newmandela
Error: mysqlcheck doesn‘t support multiple contradicting commands.
上面的命令报错了,去掉 -c
# mysqlcheck -uroot -p --auto-repair -o newmandela
Enter password:
newmandela.account
note : Table does not support optimize, doing recreate + analyze instead
status : OK
newmandela.alarm
note : Table does not support optimize, doing recreate + analyze instead
status : OK
newmandela.alarm_settings
note : Table does not support optimize, doing recreate + analyze instead
status : OK
每张表都出现了 Table does not support optimize, doing recreate + analyze instead
, 代表什么意思呢? 它的意思不是说 innodb 引擎不支持 优化,可以参考 http://stackoverflow.com/questions/30635603/what-does-table-does-not-support-optimize-doing-recreate-analyze-instead-me 的回答。
mysqlcheck 常用选项
A, –all-databases
表示所有库-a, –analyze
分析表-o, –optimize
优化表-r, –repair
修复表错误-c, –check
检查表是否出错–auto-repair
自动修复损坏的表-B, –databases
选择多个库-1, –all-in-1
Use one query per database with tables listed in a comma separated way-C, –check-only-changed
检查表最后一次检查之后的变动-g, –check-upgrade
Check for version dependent changes in the tables-F, –fast
Check tables that are not closed properly–fix-db-names
Fix DB names–fix-table-names
Fix table names-f, –force
Continue even when there is an error-e, –extended
Perform extended check on a table. This will take a long time to execute.-m, –medium-check
Faster than extended check option, but does most checks-q, –quick
Faster than medium check option
[MySQL] 怎样使用Mysqlcheck来检查和修复, 优化表
标签:文档 pos list 内容 情况下 nlog 5.6 blank bsp
本文系统来源:https://www.cnblogs.com/hanxiaohui/p/8398232.html
内容总结
以上是互联网集市为您收集整理的[MySQL] 怎样使用Mysqlcheck来检查和修复, 优化表全部内容,希望文章能够帮你解决[MySQL] 怎样使用Mysqlcheck来检查和修复, 优化表所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。