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

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...

Recursive chmod / Permission Change Across Directories for a File Type

The following command may be very useful for changing the permissions of a file type such as .php...

FTP Failed: Service check failed to complete Unable to connect to port 21

The service “ftpd” appears to be down. The system failed to connect to this service’s TCP/IP...

connection failed for acme-v01-api-letsencrypt org: SSL connect attempt failed

 (Hypertext Transfer Protocol) “post” request to...

Disable cPanel Brute Force Command Line

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