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

Nginx redirecting folder to another host or server

From time to time you may want to proxy out a path to another server or location. To perform a...

Account's error_log produces flood of missing modules.

 Account's error_log produces flood of missing modules. Ex: From error_log:     [23-Apr-2018...

Manually Clear from Console / Command Line cPanel Exim Mail Queue

To clear the cPanel exim mail queue quickly from a command line / shell use the following...

Reset cPanel Max Defers for an Account

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

Create CXS Quarantine Directory

The following command may be used to create a quarantine directory for Configserver's CXS: cxs...