Repairing and Optimizing all MySQL and MariaDB Databases on the Server

From time to time you will find repairing and optimizing your databases are necessary. From a shell the following may be useful for mySQL and MariaDBs:



Repair and optimized DBs

find /var/lib/mysql -name '*.MYI' -exec myisamchk -r {} \;
find /var/lib/mysql -name '*.MYI' -exec myisamchk -o {} \;

Force repair:

find /var/lib/mysql -name '*.MYI' -exec myisamchk -rf {} \;

mysqlcheck Repair and Optimize:

mysqlcheck --repair --use-frm --all-databases
mysqlcheck -o -A
  • 147 Users Found This Useful

Was this answer helpful?

Related Articles

SpamAssassin Command Line Bayesian Learn Command cPanel

Once it is enabled, it is necessary to train spamassassin to learn what is junk mail and what is...

cPanel Max Defers Occurring for an Account

While viewing exim_mainlog and seeing the following:   enforce_mail_permissions: Domain...

Error: rpmdb open failed with cPanel

This can occur with older packages sitting on your drive. Try running the following: rm -f...

Error: Multilib version problems found

Finished Dependency Resolution Error:  Multilib version problems found. This often means that...

Failed to lock proc mutex: Permission denied

The error : Failed to lock proc mutex: Permission denied can occur when using mod_ruid2 with...