myisamchk supports the following options for
table repair operations (operations performed when an option
such as --recover or
--safe-recover is given):
--backup,-BCommand-Line Format --backupMake a backup of the
.MYDfile asfile_name-time.BAK-
Command-Line Format --character-sets-dir=pathType String Default Value [none]The directory where character sets are installed. See Section 12.15, “Character Set Configuration”.
-
Command-Line Format --correct-checksumCorrect the checksum information for the table.
--data-file-length=,len-DlenCommand-Line Format --data-file-length=lenType Numeric The maximum length of the data file (when re-creating data file when it is “full”).
--extend-check,-eCommand-Line Format --extend-checkDo a repair that tries to recover every possible row from the data file. Normally, this also finds a lot of garbage rows. Do not use this option unless you are desperate.
See also the description of this option under table checking options.
For a description of the output format, see Section 6.6.4.5, “Obtaining Table Information with myisamchk”.
--force,-fCommand-Line Format --forceOverwrite old intermediate files (files with names like
) instead of aborting.tbl_name.TMD--keys-used=,val-kvalCommand-Line Format --keys-used=valType Numeric For myisamchk, the option value is a bit value that indicates which indexes to update. Each binary bit of the option value corresponds to a table index, where the first index is bit 0. An option value of 0 disables updates to all indexes, which can be used to get faster inserts. Deactivated indexes can be reactivated by using myisamchk -r.
-
Command-Line Format --max-record-length=lenType Numeric Skip rows larger than the given length if myisamchk cannot allocate memory to hold them.
--quick,-qCommand-Line Format --quickAchieve 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,-rCommand-Line Format --recoverDo a repair that can fix almost any problem except unique keys that are not unique (which is an extremely unlikely error with
MyISAMtables). If you want to recover a table, this is the option to try first. You should try--safe-recoveronly if myisamchk reports that the table cannot be recovered using--recover. (In the unlikely case that--recoverfails, the data file remains intact.)If you have lots of memory, you should increase the value of
myisam_sort_buffer_size.--safe-recover,-oCommand-Line Format --safe-recoverDo a repair using an old recovery method that reads through all rows in order and updates all index trees based on the rows found. This is an order of magnitude slower than
--recover, but can handle a couple of very unlikely cases that--recovercannot. This recovery method also uses much less disk space than--recover. Normally, you should repair first using--recover, and then with--safe-recoveronly if--recoverfails.If you have lots of memory, you should increase the value of
key_buffer_size.-
Command-Line Format --set-collation=nameType String Specify the collation to use for sorting table indexes. The character set name is implied by the first part of the collation name.
--sort-recover,-nCommand-Line Format --sort-recoverForce myisamchk to use sorting to resolve the keys even if the temporary files would be very large.
--tmpdir=,dir_name-tdir_nameCommand-Line Format --tmpdir=dir_nameType Directory name The path of the directory to be used for storing temporary files. If this is not set, myisamchk uses the value of the
TMPDIRenvironment variable.--tmpdircan be set to a list of directory paths that are used successively in round-robin fashion for creating temporary files. The separator character between directory names is the colon (:) on Unix and the semicolon (;) on Windows.--unpack,-uCommand-Line Format --unpackUnpack a table that was packed with myisampack.