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
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