mySQL: repair and optimize all tables in all databases

mysqlcheck -u root -p --auto-repair --optimize --all-databases

You will be asked for root password and command will run. If you want to do it through cron, put your password immediately after -p… like -ppassword.

CC0 1.0 To the extent possible under law, the creator has waived all copyright and related or neighboring rights to this work.