How to optimize all tables from all databases
The following command will optimize all of your databases' tables within MySQL.
It is important to optimize tables to reduce data fragmentation.
mysqlcheck -Aop -uroot |
If you are not using root replace it with your username.
-A : Check all tables in all databases. This is the same as using the --databases option and naming all the databases on the command line.
-o : optimize the tables.
-p : Prompts for a password to use when connecting to the MySQL server.
-u : The MySQL user name to use when connecting to the server.
Inspired by this article.

























Gustaf Segerström said
July 29 2011 @ 5:16 PM
Thank you! Saved me a lot of time to do it through terminal instead of PHPMyadmin.