The options described in this section can be used for any type of table maintenance operation performed by myisamchk. 本节中描述的选项可用于myisamchk执行的任何类型的表维护操作。The sections following this one describe options that pertain only to specific operations, such as table checking or repairing.本节后面的部分描述了仅适用于特定操作的选项,如表检查或修复。
--help
, -?
Display a help message and exit. Options are grouped by type of operation.显示帮助消息并退出。选项按操作类型分组。
--HELP
, -H
Display a help message and exit. Options are presented in a single list.显示帮助消息并退出。选项显示在一个列表中。
--debug=
, debug_options
-#
debug_options
Write a debugging log. A typical 编写调试日志。典型的debug_options
string is d:t:o,
. The default is file_name
d:t:o,/tmp/myisamchk.trace
.debug_options
字符串是d:t:o,file_name
。默认值是d:t:o,/tmp/myisamchk.trace
。
This option is available only if MySQL was built using 仅当MySQL使用WITH_DEBUG
. WITH_DEBUG
构建时,此选项才可用。MySQL release binaries provided by Oracle are not built using this option.Oracle提供的MySQL发布二进制文件不是使用此选项构建的。
--defaults-extra-file=
file_name
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. 在全局选项文件之后读取此选项文件,但(在Unix上)在用户选项文件之前读取。如果文件不存在或无法访问,则会发生错误。If 如果file_name
is not an absolute path name, it is interpreted relative to the current directory.file_name
不是绝对路径名,则会相对于当前目录进行解释。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
Use only the given option file. If the file does not exist or is otherwise inaccessible, an error occurs. If 仅使用给定的选项文件。如果文件不存在或无法访问,则会发生错误。如果file_name
is not an absolute path name, it is interpreted relative to the current directory.file_name
不是绝对路径名,则会相对于当前目录进行解释。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
Read not only the usual option groups, but also groups with the usual names and a suffix of 不仅要读取常用的选项组,还要读取具有常用名称和后缀str
. str
的组。For example, myisamchk normally reads the 例如,myisamchk通常读取[myisamchk]
group. [myisamchk]
组。If this option is given as 如果将此选项设置为--defaults-group-suffix=_other
, myisamchk also reads the [myisamchk_other]
group.--defaults-group-suffix=_other
,myisamchk也会读取[mysamchk_other]
组。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
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.--no-defaults
来阻止读取它们。
The exception is that the 例外的是,.mylogin.cnf
file is read in all cases, if it exists. .mylogin.cnf
文件在所有情况下都会被读取(如果存在的话)。This permits passwords to be specified in a safer way than on the command line even when 这允许以比命令行更安全的方式指定密码,即使使用--no-defaults
is used. --no-defaults
。To create 要创建.mylogin.cnf
, use the mysql_config_editor utility. .mylogin.cnf
,请使用mysql_config_editor实用程序。See Section 4.6.7, “mysql_config_editor — MySQL Configuration Utility”.请参阅第4.6.7节,“mysql_config编辑器--mysql配置实用程序”。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
Print the program name and all options that it gets from option files.打印程序名称及其从选项文件中获取的所有选项。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
--silent
, -s
Silent mode. Write output only when errors occur. You can use 静音模式。仅在出现错误时写入输出。您可以使用-s
twice (-ss
) to make myisamchk very silent.-s
两次(-ss
)使myisamchk非常安静。
--verbose
, -v
Verbose mode. Print more information about what the program does. This can be used with 详细模式。打印有关程序功能的更多信息。这可以与-d
and -e
. -d
和-e
一起使用。Use 多次使用-v
multiple times (-vv
, -vvv
) for even more output.-v
(-vv
,-vvv
)可获得更多输出。
--version
, -V
Display version information and exit.显示版本信息并退出。
--wait
, -w
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.如果您在禁用外部锁定的情况下运行mysqld,则只能通过另一个myisamchk命令锁定该表。
You can also set the following variables by using 您还可以使用--
syntax:var_name
=value
--var_name=value
语法设置以下变量:
Variable | Default Value |
---|---|
decode_bits | 9 |
ft_max_word_len | version-dependent |
ft_min_word_len | 4 |
ft_stopword_file | built-in list |
key_buffer_size | 523264 |
myisam_block_size | 1024 |
myisam_sort_key_blocks | 16 |
read_buffer_size | 262136 |
sort_buffer_size | 2097144 |
sort_key_blocks | 16 |
stats_method | nulls_unequal |
write_buffer_size | 262136 |
The possible myisamchk variables and their default values can be examined with myisamchk --help:可以使用myisamchk --help检查可能的myisamchk变量及其默认值:
myisam_sort_buffer_size
is used when the keys are repaired by sorting keys, which is the normal case when you use --recover
. sort_buffer_size
is a deprecated synonym for myisam_sort_buffer_size
.myisam_sort_buffer_size
用于通过排序键来修复键,这是使用--recover
时的正常情况。sort_buffer_size
是myisam_sort_buffer_size
的一个已弃用的同义词。
当您使用key_buffer_size
is used when you are checking the table with --extend-check
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:--extend-check
检查表时,或者当通过逐行向表中插入键来修复键时(就像进行正常插入时一样),使用key_buffer_size
。在以下情况下使用密钥缓冲区进行修复:
You use --safe-recover
.
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 当CHAR
, VARCHAR
, or TEXT
columns, because the sort operation needs to store the complete key values as it proceeds. CHAR
、VARCHAR
或TEXT
列的键值较大时,通常会出现这种情况,因为排序操作需要在进行过程中存储完整的键值。If you have lots of temporary space and you can force myisamchk to repair by sorting, you can use the 如果您有很多临时空间,并且可以通过排序强制myisamchk进行修复,则可以使用--sort-recover
option.--sort-recover
选项。
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 如果你想更快地修复,请将key_buffer_size
and 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.key_buffer_size
和myisam_sort_buffer_size
变量设置为可用内存的25%左右。您可以将这两个变量都设置为较大的值,因为一次只使用其中一个。
myisam_block_size
is the size used for index blocks.myisam_block_size
是用于索引块的大小。
stats_method
influences how NULL
values are treated for index statistics collection when the --analyze
option is given. stats_method
会影响在给定--analyze
选项时如何处理索引统计信息收集的NULL
值。It acts like the 它的作用类似于myisam_stats_method
system variable. For more information, see the description of myisam_stats_method
in Section 5.1.8, “Server System Variables”, and Section 8.3.8, “InnoDB and MyISAM Index Statistics Collection”.myisam_stats_method
系统变量。有关更多信息,请参阅第5.1.8节,“服务器系统变量”和第8.3.8节,“InnoDB和myisam索引统计数据收集”中对myisam_stats_method
的描述。
ft_min_word_len
and ft_max_word_len
indicate the minimum and maximum word length for FULLTEXT
indexes on MyISAM
tables. ft_min_vord_len
和ft_max_word_len
表示MyISAM
表上FULLTEXT索引的最小和最大字长。ft_stopword_file
names the stopword file. These need to be set under the following circumstances.ft_stopword_file
命名停用词文件。这些需要在以下情况下设置。
If you use myisamchk to perform an operation that modifies table indexes (such as repair or analyze), the 如果使用myisamchk执行修改表索引的操作(如修复或分析),则除非另有指定,否则将使用最小和最大字长的默认全文参数值以及stopword文件重建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.FULLTEXT
索引。这可能会导致查询失败。
The problem occurs because these parameters are known only by the server. They are not stored in 出现问题的原因是这些参数只有服务器知道。它们不存储在MyISAM
index files. MyISAM
索引文件中。To avoid the problem if you have modified the minimum or maximum word length or the stopword file in the server, specify the same 为了避免在修改了服务器中的最小或最大字长或停用词文件时出现问题,请为myisamchk指定与mysqld相同的ft_min_word_len
, ft_max_word_len
, and ft_stopword_file
values to myisamchk that you use for mysqld. ft_min_word_len
、ft_max_word_lan
和ft_stopword_file
值。For example, if you have set the minimum word length to 3, you can repair a table with myisamchk like this:例如,如果你将最小字长设置为3,你可以用myisamchk修复一个表,如下所示:
myisamchk --recover --ft_min_word_len=3 tbl_name
.MYI
To ensure that myisamchk and the server use the same values for full-text parameters, you can place each one in both the 为了确保myisamchk和服务器对全文参数使用相同的值,您可以将每个值放在选项文件的[mysqld]
and [myisamchk]
sections of an option file:[mysqld]
和[mysimchk]
部分:
[mysqld] ft_min_word_len=3 [myisamchk] ft_min_word_len=3
An alternative to using myisamchk is to use the 使用myisamchk的另一种方法是使用REPAIR TABLE
, ANALYZE TABLE
, OPTIMIZE TABLE
, or ALTER TABLE
. REPAIR TABLE
、ANALYZE TABLE
、OPTIMIZE TABLE
或ALTER TABLE
。These statements are performed by the server, which knows the proper full-text parameter values to use.这些语句由服务器执行,服务器知道要使用的正确全文参数值。