Optimize all mysql tables by shell

Time it’s up and you have to maintenance database and optimize all tables to get better performance.
For that reason you can use following script as well as OPTIMIZE TABLE command.

Optimize table

Usage of simple mysqlcheck command is also possibe

Optimize all tables at once by shell script

Nice version with text dialog and progress bar

Screen of process with nice dialog version

Screen of process with nice dialog version

Do not forget, set proper rights to enable execution of script.

Now you should just wait when process is done. Finnally you should use cron for schedule job daily, for that you should set password and user name manualy. What means, replace lines read USER and read PASSWORD with USER=”root” and PASSWORD=”” or use another DBA credentails.

Cron configuration

Make link to script file with following command like.

Příspěvek byl publikován v rubrice Advanced Mysql. Můžete si uložit jeho odkaz mezi své oblíbené záložky.