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

Share this page:


Was this article useful? Have any suggestions or improvements to the information?

Also Read

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

Clear cPanel Eximstats DB and Repairing the Eximstats DB

Over the time or due to spammers the eximstats database file may grow to a large size. To clear...

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

Permission denied: /home/username/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

When checking your error log you find the error 508 or 403 forbidden error in your browser and...

Create CXS Quarantine Directory

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