How optimize all database?

blog

Verified User
Joined
Jan 28, 2011
Messages
131
What is best and safe solution optimize all database on server?

This can use?

chk="select concat(TABLE_SCHEMA,'.', TABLE_NAME) from information_schema.tables where data_free>0;"

for tbl in $(mysql -u root -pxxx -N <<< $chk)
do
mysql -u xxx -pxxx -N <<< "optimize table $tbl"
done
 
Top