Optimize and repair all mysql databases at once

Posted By Scott Klarr on Mar 06, 2008 at 1:27 am

There is a really handy MySql utility called mysqlcheck that allows you to do a number of actions to all databases on your mysql server at once. I am writing this specifically for Linux, but I'm sure windows and Unix versions are very similar if not exactly the same. Run this command as root (super user)

mysqlcheck -Aor mysqlcheck -Ar mysqlcheck -Ao

Argument Definitions

-A - Check all Mysql databases
-r - Repair all Mysql databases
-o - Optimize all Mysql databases

To see all of the available options, run mysqlcheck --help

This post has the following tags:

Related Links

Comments (3)

cjk - Sep 04, 2008

No you should not add the mysql root password, because it would potentially be visible when you do `ps aufwwx`. At least when you do it interactively, don't use -pXYZ.

Aaron Moon - Jul 02, 2008

WOW this is a nice tool, I have actually set this to run as a cron job, and post the output to an admin mail I have this run about once per week late sunday to insure low load times.....

Vladimir - May 15, 2008

You should also add mysql root password to this command. In the example shown MySQL password is not set, that seems to be a risky configuration

Post Comment

Your Name
Email Address
Website URL
Comment

Your email address will not be visible to the public

page counter

Loading Ad