Repair and optimize all tables in all MySQL databases

MySQL tables can crash or become corrupt quite easily if you don’t shut down the server correctly, for example hard reboot or power outage.

Thankfully there is a quick way of repairing all the tables.

Select check / -auto-repair or optimize

[codesyntax lang=”bash”]
mysqlcheck –auto-repair | –check | –optimize –all-databases

You may need to specify the username and/or password -u or -p

See the mysqlcheck docs for more information.

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *