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
  • 141 Users Found This Useful

Was this answer helpful?

Related Articles

Error: Multilib version problems found

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

This webpage is not available ERR_SSL_VERSION_OR_CIPHER_MISMATCH

This webpage is not availableERR_SSL_VERSION_OR_CIPHER_MISMATCHA secure connection cannot be...

yum-utils not installed or found on Centos5 64-bit

When yum-utils is not installed or found on Centos5 64-bit the following commands may be used:...

Remount /tmp with exec permission

There are times where you may need to have exec permission available for the /tmp folder. This...

Disable cPanel Brute Force Command Line

To disable the cPanel brute force detection from the command line usee the following:...