Quickly repair a huge corrupted/crashed table in MySQL

by jagbir on February 17, 2009

So you got the notice that one of table from large DB is crashed/corrupted. You can start a repair table command inside MySQL prompt or from phpmyadmin but if you have enough free RAM in your server, you’d better tweak some options of ‘myisamchk’ and execute it from command prompt. That can save a lot of time :)

Here is a reapir command that I just executed to repair a table having size of 3.2 GB:

# myisamchk –silent –force –update-state –key_buffer_size=1024M –sort_buffer_size=1024M –read_buffer_size=16M –write_buffer_size=16M tbl_mailing

Here, tbl_mailing is the name of table to be repaired. You’ve to execute this command inside the directory which holds actual data files. for example, if your database name is ‘maildb’, then by default, the path will be /var/lib/mysql/maildb.

Previous post:

Next post: