下面說下幾個參數的含義
-a, --analyze 分析 [Analyze given tables]
-o, --optimize 優化 [Optimize table]
-A, --all-databases 所有的數據庫 [Check all the database]
--auto-repair 自動修復 [If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found]
vi /opt/shell/mysql_opt.sh
/usr/local/mysql/bin/mysqlcheck -Aao -auto-repair -uroot -p
加入 crontab
* * */1 * * /opt/shell/mysql_opt.sh