mysqlcheck -u app -p --optimize appdb

Category: Databases & SQL

mysqlcheck -u app -p --optimize appdb

Optimize tables

Runs OPTIMIZE TABLE, which rebuilds InnoDB tables to reclaim fragmented space, the MySQL analogue of VACUUM FULL. It locks each table, so schedule it in a maintenance window.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.