–check, -c
Check the table for errors. This is the default operation if you specify no option that selects an operation type explicitly.
–force, -f
Do a repair operation automatically if myisamchk finds any errors in the table. The repair type is the same as that specified with the –recover or -r option.
–information, -i
Print informational statistics about the table that is checked.
–medium-check, -m
Do a check that is faster than an –extend-check operation. This finds only 99.99% of all errors, which should be good enough in most cases.
–backup, -B
Make a backup of the .MYD file as file_name-time.BAK
–force, -f
Overwrite old intermediate files (files with names like tbl_name.TMD) instead of aborting.
–quick, -q
Achieve a faster repair by modifying only the index file, not the data file. You can specify this option twice to force myisamchk to modify the original data file in case of duplicate keys.
–recover, -r
Do a repair that can fix almost any problem except unique keys that are not unique (which is an extremely unlikely error with MyISAM tables). If you want to recover a table, this is the option to try first. You should try –safe-recover only if myisamchk reports that the table cannot be recovered using –recover. (In the unlikely case that –recover fails, the data file remains intact.)
If you have lots of memory, you should increase the value of myisam_sort_buffer_size.
cd /var/lib/mysql cd database-name for file in *.MYI; do echo myisamchk --medium-check $(basename $file .MYI); done
cd /var/lib/mysql for file in $(find . -name "*.MYI"); do echo myisamchk --medium-check "$(dirname $file)/$(basename $file .MYI)"; done
myisamchk --check --silent --fast /path/to/datadir/*/*.MYI myisamchk --check --fast /path/to/datadir/*/*.MYI
find /var/lib/mysql -name "*.MYI" | xargs myisamchk --check --fast --silent find /var/lib/mysql -name "*.MYI" | xargs myisamchk --check --fast
myisamchk -r database_name/table_name.MYI
myisamchk --key_buffer_size=512M --sort_buffer_size=512M --read_buffer_size=8M --write_buffer_size=8M path/to/table/file/.MYI