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

E Sysup: Needed system RPMs were not installed: yum-utils

When encountering the following:E Sysup: Needed system RPMs were not installed: yum-utils*****...

SpamAssassin Command Line Bayesian Learn Command cPanel

Once it is enabled, it is necessary to train spamassassin to learn what is junk mail and what is...

Error: Multilib version problems found

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

How to convert InnoDB to MyISAM

Although at times faster, you will find InnoDB a very large headache when it comes to table...

FSCK Options and Maintenance

Provided below are some useful commands pertaining to FSCK. Update commands to your environment /...