Mysql + Repair All Databases or All Tables of Particular Database(s)
Running as root,
this command will repair all mysql databases on the server.
Yes, this will take some time!
Note, on PM servers, if you’re logged in as root, then you do not need to specify the password. Other servers may vary.
mysqlcheck -Aao --auto-repair -u root
“A” == –all-databases == Consider all the databases
“a” == –analyze == Analyzes tables
“o” == –optimize == Optimize tables
You can choose to repair just one (or more) databases with:
mysqlcheck [options] --databases DB_NAME ...
DB_NAME is the database(s) you wish to repair (yes, you can specify several if you with, separated by spaces).