MySQL Variables myisam_recover_options 数据库 参数变量解释及正确配置使用

本站中文解释

MySQL参数变量myisam_recover_options控制MyISAM表在启动MySQL服务器时进行修复表操作的执行程度。它可以设置为下述值之一:

1.BACKUP:使用已经在数据目录中创建的拷贝修复MyISAM表。

2.FORCE:仅修复不要拷贝。

3.QUICK:只尝试通过重新建索引加快恢复。

4.DEFAULT:使用值FORCE。

要设置myisam_recover_options参数,你可以在MySQL服务器的配置文件my.cnf中添加以下语句:

#在启动时修复MyISAM表

myisam_recover_options=FORCE

官方英文解释

myisam_recover_options

Command-Line Format --myisam-recover-options[=list]
System Variable myisam_recover_options
Scope Global
Dynamic No
Type Enumeration
Default Value OFF
Valid Values

OFF

DEFAULT

BACKUP

FORCE

QUICK

Set the MyISAM storage engine recovery
mode. The variable value is any combination of the values of
OFF, DEFAULT,
BACKUP, FORCE, or
QUICK. If you specify multiple values,
separate them by commas. Specifying the variable with no value
at server startup is the same as specifying
DEFAULT, and specifying with an explicit
value of "" disables recovery (same as a
value of OFF). If recovery is enabled, each
time mysqld opens a
MyISAM table, it checks whether the table
is marked as crashed or was not closed properly. (The last
option works only if you are running with external locking
disabled.) If this is the case, mysqld runs
a check on the table. If the table was corrupted,
mysqld attempts to repair it.

The following options affect how the repair works.

Option Description
OFF No recovery.
DEFAULT Recovery without backup, forcing, or quick checking.
BACKUP If the data file was changed during recovery, save a backup of the
tbl_name.MYD
file as
tbl_name-datetime.BAK.
FORCE Run recovery even if we would lose more than one row from the
.MYD file.
QUICK Do not check the rows in the table if there are not any delete blocks.

Before the server automatically repairs a table, it writes a
note about the repair to the error log. If you want to be able
to recover from most problems without user intervention, you
should use the options BACKUP,FORCE. This
forces a repair of a table even if some rows would be deleted,
but it keeps the old data file as a backup so that you can
later examine what happened.

See Section 15.2.1, “MyISAM Startup Options”.


数据运维技术 » MySQL Variables myisam_recover_options 数据库 参数变量解释及正确配置使用