Tuesday, December 14, 2010

Repair your Corrupted MySQL Database

Yesterday one of our computer’s user partition filled up automatically that caused database corruption in the mysql database. After freeing the space from the partition, we ran some commands to repair and recover mysql database. Here is the list what we did yesterday:

1.cd into your directory where your database files are stored. In my case it was in the /usr…/data/mysql/ folder.

2.Then We run this command:
myisamchk *.MYI | grep -3 –color corrupted

3.After running above command this should give you some output on the current state of your database files & indicate which file is corrupted and need to repair. This also gives you the next command to run on the line that is:
Fix it using switch “-r” or “-o”

4.So that is we did
myisamchk -r file.MYI

5.Your database should be repaired

No comments:

Post a Comment

Post a Comment