The options described in this section can be used for any type of table maintenance operation performed by myisamchk. The sections following this one describe options that pertain only to specific operations, such as table checking or repairing.
Display a help message and exit. Options are grouped by type of operation.
Display a help message and exit. Options are presented in a single list.
Write a debugging log. A typical
debug_options string is
The default is
Read this option file after the global option file but (on
Unix) before the user option file. If the file does not
exist or is otherwise inaccessible, an error occurs.
file_name is the full path name
to the file.
Use only the given option file. If the file does not exist
or is otherwise inaccessible, an error occurs.
file_name is the full path name
to the file.
Read not only the usual option groups, but also groups with
the usual names and a suffix of
str. For example,
myisamchk normally reads the
[myisamchk] group. If the
option is given, myisamchk also reads the
Do not read any option files. If program startup fails due
to reading unknown options from an option file,
--no-defaults can be used
to prevent them from being read.
Print the program name and all options that it gets from option files.
Silent mode. Write output only when errors occur. You can
-s twice (
-ss) to make
myisamchk very silent.
Verbose mode. Print more information about what the program
does. This can be used with
-v multiple times
-vvv) for even more
Display version information and exit.
Instead of terminating with an error if the table is locked, wait until the table is unlocked before continuing. If you are running mysqld with external locking disabled, the table can be locked only by another myisamchk command.
You can also set the following variables by using
sort_buffer_size is used when the keys are
repaired by sorting keys, which is the normal case when you use
--recover. As of MySQL 5.1.67,
myisam_sort_buffer_size is available as an
alternative name to
myisam_sort_buffer_size is preferable to
sort_buffer_size because its name corresponds
server system variable that has a similar meaning.
sort_buffer_size should be considered
key_buffer_size is used when you are checking
the table with
or when the keys are repaired by inserting keys row by row into
the table (like when doing normal inserts). Repairing through
the key buffer is used in the following cases:
The temporary files needed to sort the keys would be more
than twice as big as when creating the key file directly.
This is often the case when you have large key values for
TEXT columns, because the
sort operation needs to store the complete key values as it
proceeds. If you have lots of temporary space and you can
force myisamchk to repair by sorting, you
can use the
Repairing through the key buffer takes much less disk space than using sorting, but is also much slower.
If you want a faster repair, set the
myisam_sort_buffer_size variables to about
25% of your available memory. You can set both variables to
large values, because only one of them is used at a time.
myisam_block_size is the size used for index
stats_method influences how
NULL values are treated for index statistics
collection when the
option is given. It acts like the
myisam_stats_method system variable. For more
information, see the description of
Section 5.1.4, “Server System Variables”, and
Section 8.5.4, “InnoDB and MyISAM Index Statistics Collection”.
ft_max_word_len indicate the minimum and
maximum word length for
ft_stopword_file names the stopword file.
These need to be set under the following circumstances.
If you use myisamchk to perform an operation
that modifies table indexes (such as repair or analyze), the
FULLTEXT indexes are rebuilt using the
default full-text parameter values for minimum and maximum word
length and the stopword file unless you specify otherwise. This
can result in queries failing.
The problem occurs because these parameters are known only by
the server. They are not stored in
index files. To avoid the problem if you have modified the
minimum or maximum word length or the stopword file in the
server, specify the same
ft_stopword_file values to
myisamchk that you use for
mysqld. For example, if you have set the
minimum word length to 3, you can repair a table with
myisamchk like this:
myisamchk --recover --ft_min_word_len=3
To ensure that myisamchk and the server use
the same values for full-text parameters, you can place each one
in both the
[myisamchk] sections of an option file:
[mysqld] ft_min_word_len=3 [myisamchk] ft_min_word_len=3
An alternative to using myisamchk is to use
OPTIMIZE TABLE, or
ALTER TABLE. These statements are
performed by the server, which knows the proper full-text
parameter values to use.