热修复之mysqlcheck,(数据库xx is marked as crashed and should be repaired故障)

数据库报xx is marked as crashed and should be repaired故障。

检查单个库中的所有表:

#mysqlcheck -c basename -uroot -p

Enter password:

如下扫描到错误:

检查,优化,修复表组合命令:

#mysqlcheck -uroot -p --auto-repair -o databasename   //-o示意optimize

Enter password:

修复完成,status ok:

拓展:全部的库和表都检查一遍:

#mysqlcheck -c --all-databases -uroot -p

Enter password:

只想检查某几个库:

#mysqlcheck -c --databases basename1 basename2 -uroot -p

Enter password:

附录:

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
-- 结束。

 

posted @ 2022-10-27 12:01  巴州夜雨  阅读(63)  评论(0编辑  收藏  举报