Mysql : Repair corrupted table using myisamchk

Use the below command to list all the corrupted tables :

myisamchk -s /var/lib/mysql/*/*.MYI

Recover the tables :

myisamchk -r /var/lib/mysql/database_name/table_name.MYI

If you are getting the error ‘myisamchk: warning: 1 client is using or hasn’t closed the table properly’, the database is currently using…

then do the following :

Log into the database server : mysql -u username -p
Select the database : use database_name;
Verify the tables : show tables;
Repair the table : repair table table_name;

Thats all………. 🙂

Advertisements

One thought on “Mysql : Repair corrupted table using myisamchk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s