Optimize MySQL tables

Optimize single database table:

mysql> OPTIMIZE TABLE my_table

 

Optimize entire database:

shell# mysqlcheck -op -u root your_database_name

 

Optimize ALL databases:

shell# mysqlcheck -u root -p --auto-repair --check --optimize --all-databases