Read:
http://dev.mysql.com/doc/refman/5.0/en/repair.html∞
Corrupted mysql datafile
When doing a query, if it returns something like
Can't find file tbl_name.MYI (Errcode: nnn)
Do a
perror nnn, for instance
shell> perror 126 127 132 134 135 136 141 144 145
MySQL error code 126 = Index file is crashed
MySQL error code 127 = Record-file is crashed
MySQL error code 132 = Old database file
MySQL error code 134 = Record was already deleted (or record file crashed)
MySQL error code 135 = No more room in record file
MySQL error code 136 = No more room in index file
MySQL error code 141 = Duplicate unique key or constraint on write or update
MySQL error code 144 = Table is crashed and last repair failed
MySQL error code 145 = Table was marked as crashed and should be repaired
myisamchk
If you want to check all
MyISAM tables and repair any that are corrupted, you can use the following command:
myisamchk --silent --force --fast --update-state \
--key_buffer_size=64M --sort_buffer_size=64M \
--read_buffer_size=1M --write_buffer_size=1M \
/path/to/datadir/*/*.MYI
If the error code is 145, do a
myismchk /path/to/db.MYI will fix the error.
If the error code is 135, do
ALTER TABLE tbl_name MAX_ROWS=xxx AVG_ROW_LENGTH=yyy;
There are no comments on this page. [Add comment]