Repair And Optimize All Tables In All MySQL Databases Using Command

by lifeLinux on August 1, 2011

There’s a simple command to automatically check, repair and optimize all tables in all databases when you’re running a MySQL server on Linux / Unix / BSD.

mysqlcheck -u{username} -p{password}  –check –optimize –auto-repair –all-databases


Where:
{username} – user full access to the all databases
{password} – password for {user} account

mysqlcheck uses the SQL statements CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE in a convenient way for the user. It determines which statements to use for the operation you want to perform, and then sends the statements to the server to be executed.

See the mysqlcheck docs for more information.

Previous post:

Next post: