The Mysqlcheck client tool can examine and fix myisam tables, and can also optimize and analyze tables.
In fact, it integrates the functions of check, repair, analyze, optimize in MySQL tools,
There are 3 different ways to invoke Mysqlcheck:
shell> mysqlcheck[options] db_name [tables]
shell> mysqlcheck[options]---database DB1 [DB2 DB3 ...]
Shell> Mysqlcheck[options]--all--database
If you do not specify any tables or use the---database or--all--database option,
The entire database is checked.
option has the following common options:
-C,--check (check sheet);
-R,--repair (repair table);
-A,--analyze (analysis table);
-O,--optimize (tuning table);//Where the default option is-C (checklist)
Example:
checklist (check);
Mysqlcheck-u root-c Test
Repair table (repair);
Mysqlcheck-u root-r Test
Repair the specified database with the
# mysqlcheck-a-o-r database_name-p
Check the repair of all databases (table;
# mysqlcheck-u root-a -0-r-P
Automatically optimizes MySQL database on a regular basis
CRONTAB-E//Add it to the cron job to automate every day at 01:00
0 1 * * * mysqlcheck-aao–auto-repair-u your username-p your password >/dev/null 2>&1
The above Linux system under the Mysqlcheck Repair Database command (detailed) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.