How to setup a mysqlcheck cronjob in Virtualmin to run automatically every midnight and make it check, optimize and repair all of your databases and tables.
Setup mysqlcheck cronjob in Virtualmin
– Login to Virtualmin
– browse to Webmin >> System >> Scheduled Cron Jobs
– Click on >> Create a new scheduled cron job.
– set “Execute as” to = root
– set “Command” to = mysqlcheck -orA -pPassword > /dev/null
(Where “password” is your root password.)
- -o = Optimize the tables
-r =Perform a repair that can fix almost anything except unique keys that are not unique.
-A =Check all tables in all databases.
- -p = use password
– Set “Simple schedule ..” to = Daily at midnight
– Click Save
mysqlcheck will now run automatically, check optimize, repair all of your databases and tables every night at midnight.