I set this up mostly because Spam Karma leaves giant overhead in my WordPress MySQL database. But it can’t hurt running it on the rest of my databases.
My cron job, which runs at 6:05am every first of the month looks a bit like this
# Optimize all of my popular databases. This is run from a cron job monthly or so.
echo -n "Started database optimization at ";/bin/date; echo -e "\n\n";
/usr/bin/mysqlcheck -o -v -u user -ppassword -h mysql.lee.org blogdatabase;
echo -e "Finished blogdatabase\n\n";
/usr/bin/mysqlcheck -o -v -u otheruser -potherpw -h mysql.lee.org otherdatabase;
echo -e "Finished gallerydatabase\n\n";
echo -n "Finished database optimization at ";/bin/date; echo -e "\n\n";
I get a monthly email with the output that I can look over.