Repair All MyISAM Tables on All Databases on Server

Issue: MyISAM tables sometimes need repair, but website owners often fail to advise that their websites are not working.

Solution: Use a proactive approach and leverage a cronjob to automatically complete the repair process.

SSH into server as root and run the command:

mysqlcheck --all-databases -r

To repair all MyISAM tables every hour, add a cron job:

crontab - e
10 * * * * mysqlcheck --all-databases -r >/dev/null 2>&1

The above will repair all MyISAM tables, on all databases, at 10 minutes past every hour.

This also has the added benefit of leaving tables in an optimized state, after repair.

1 thought on “Repair All MyISAM Tables on All Databases on Server”

Leave a comment