7 Jan 09

It is recommended that every tables in MySQL databases are checked at least once a day on a busy server. but it would be not convenient enough for the database administrator to login to the server everyday or launching other programs to optimize the databases one by one for table by table.

You can Automate the optimization on a Webmin Cpanel by following this…

go to System >> Scheduled Cron Jobs. Then click on Create a new scheduled cron job.

use this commands.

Execute cron job as: root
Active?: YES
Command: mysqlcheck -Aao –auto-repair -u root -p[password]

* no space between -p and the password *

The above command will analyze (-a), optimize (-o), and auto repair (–auto-repair) all (-A) databases on the server. You can set the Simple schedule at the time you prefer, I suggest you look at the traffic log, and choose the period that your server usually receive the least traffic.

-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]

After filling in the whole form, click on Create, and Youre done.