Home >Database >Mysql Tutorial >mysqlcheck repair database command (Linux system)
The following editor will bring you an articleLinuxmysqlcheck repair database command (detailed explanation) under the system. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Come and take a look with the editor, I wish you all a happy game
mysqlcheck clientTool can check and repair MyISAM tables, and can also optimize and analyze tables.
In fact, it integrates the functions of check, repair, analyze, and optimize in the mysql tool.
There are 3 ways to call mysqlcheck:
shell> mysqlcheck[options] db_name [tables] shell> mysqlcheck[options] ---database DB1 [DB2 DB3...] shell> mysqlcheck[options] --all--database
If no table is specified or the ---database or --all--database option is used,
the entire database is checked .
option has the following common options:
-c, --check (check list);
-r , --repair (repair table);
-a, --analyze (analyze table);
-o, --optimize (optimize table); // Among them, the default option is -c (check table)
Example:
Check table (check);
mysqlcheck -u root -c test
Repair the table (repair);
mysqlcheck -u root -r test
Repair the specified Use
# mysqlcheck -A -o -r Database_NAME -p
to check and repair all databases (table;
# mysqlcheck -u root -A -0 -r -p
Daily scheduled automatic optimizationMySQL database
crontab -e //Add it to cron job is automatically executed at 01:00 every day
0 1 * * * mysqlcheck -Aao –auto-repair -u your username -p your password> /dev/null 2> ;&1
The above mysqlcheck database repair command under Linux system (detailed explanation) is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home ##. #
The above is the detailed content of mysqlcheck repair database command (Linux system). For more information, please follow other related articles on the PHP Chinese website!