Check, repair and optimize all MySQL databases
Wednesday, May 21st, 2008The following command will check, repair and optimize all databases on your MySQL server.
mysqlcheck -u root -p --auto-repair --check --optimize --all-databases
It is the equivalent of calling CHECK TABLE, REPAIR TABLE, ANALYZE TABLE and OPTIMZE TABLE for each table in each database on your server.
We tend to run this command directly after our scheduled backups.