MySQL Variables disabled_storage_engines 数据库 参数变量解释及正确配置使用
本站中文解释
MySQL disabled_storage_engines变量用于指定MySQL中会被禁止使用的存储引擎,这些存储引擎会被完全忽略,当MySQL初始化时,它会检查出哪些Storage Engine不可用。
变量的语法如下:
disabled_storage_engines = engine1[,engine2,..]
其中,engine1是第一个被禁用的存储引擎,engine2是第二个被禁用的存储引擎,等等。
要设置disabled_storage_engines变量,你可以在my.cnf/my.ini/my.conf的[mysqld]节点中添加如下语句:
disabled_storage_engines=MyISAM,InnoDB,PERORA
然后使用service mysql restart或reload重新加载配置以使其生效,此时MySQL中会被禁用MyISAM、InnoDB和PERORA存储引擎。
官方英文解释
disabled_storage_engines
Command-Line Format | --disabled-storage-engines=engine[,engine]... |
---|---|
System Variable | disabled_storage_engines |
Scope | Global |
Dynamic | No |
Type | String |
Default Value | empty string |
This variable indicates which storage engines cannot be used
to create tables or tablespaces. For example, to prevent new
MyISAM
or FEDERATED
tables from being created, start the server with these lines
in the server option file:
[mysqld] disabled_storage_engines="MyISAM,FEDERATED"
By default,
disabled_storage_engines
is
empty (no engines disabled), but it can be set to a
comma-separated list of one or more engines (not
case-sensitive). Any engine named in the value cannot be used
to create tables or tablespaces with
CREATE TABLE
or
CREATE TABLESPACE
, and cannot
be used with
ALTER TABLE ...
or
ENGINE
ALTER
to change the storage engine
TABLESPACE ... ENGINE
of existing tables or tablespaces. Attempts to do so result in
an ER_DISABLED_STORAGE_ENGINE
error.
disabled_storage_engines
does
not restrict other DDL statements for existing tables, such as
CREATE INDEX
,
TRUNCATE TABLE
,
ANALYZE TABLE
,
DROP TABLE
, or
DROP TABLESPACE
. This permits a
smooth transition so that existing tables or tablespaces that
use a disabled engine can be migrated to a permitted engine by
means such as
ALTER TABLE ...
.
ENGINE permitted_engine
It is permitted to set the
default_storage_engine
or
default_tmp_storage_engine
system variable to a storage engine that is disabled. This
could cause applications to behave erratically or fail,
although that might be a useful technique in a development
environment for identifying applications that use disabled
engines, so that they can be modified.
disabled_storage_engines
is
disabled and has no effect if the server is started with any
of these options: --bootstrap
,
--initialize
,
--initialize-insecure
,
--skip-grant-tables
.
Setting
disabled_storage_engines
might cause an issue with mysql_upgrade.
For details, see Section 4.4.7, “mysql_upgrade — Check and Upgrade MySQL Tables”.