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

ModSecurity: collection_store: Failed to access DBM file /var/cpanel/secdatadir/ip: Permission denied

The error Failed to access DBM file /var/cpanel/secdatadir/ip: Permission denied can occur on...

VPS Time not Correct with Time Server

If you have a problem with your VPS time not staying sync in a Xen VPS you will want to enable...

Disable cPanel Brute Force Command Line

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

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

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

Failed to lock proc mutex: Permission denied

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