Wednesday, 25 July 2018

MySQL: Check, Optimize and Repair Tables using Mysqlcheck

Recently, our MySQL MyISAM table corrupted due to certain reason.
Using mysqlcheck command, we can optimize, repair and analyse the tables. (For MyISAM Engine)
First, check a specific table:
You can execute this command by giving DatabaseName and Table name.
Check all the tables of a Database:
Using below command, you can also check all the tables of a Database.
Check all the tables of a multiple Database:
Check all the tables of all databases:
Analyze specific table of a Database:
When you execute ANALYZE, it lock the whole table and you can access the table only for read purpose.
Optimize specific table of a Database:
When you perform bulk deletion from table, OPTIMIZE will recover all unused spaces which generated by deletion.
Repair specific table of a Database:
Below command repairs a corrupted MyISAM table.

0 comments:

Post a Comment