MySQL: Check, Optimize and Repair Tables using Mysqlcheck

Sometimes we have found that our MySQL table not accessible and delaying response so may be table is 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 table of a Database:
Using this command, you can also check all the tables of a Database.

Check all the table of a multiple Database:

Check all the table 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 at that time OPTIMIZE will recover all unused space.

Repair specific table of a Database:
This command repair a corrupted MyISAM table.

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

2 Comments on "MySQL: Check, Optimize and Repair Tables using Mysqlcheck"

Notify of

Sort by:   newest | oldest | most voted
9 months 10 days ago

thanks q for your posting, but this is will work successfully with Engine MyISAM. for me i am using mysql with ndbcluster engine and then i tried to follow your post but i got error:
note : The storage engine for the table doesn’t support check