The MySQL server maintains many system variables that configure its operation. Each system variable has a default value. System variables can be set at server startup using options on the command line or in an option file.MySQL服务器维护许多配置其操作的系统变量。每个系统变量都有一个默认值。系统变量可以在服务器启动时使用命令行或选项文件中的选项进行设置。Most of them can be changed dynamically at runtime using the 其中大多数可以在运行时使用SET
statement, which enables you to modify operation of the server without having to stop and restart it. You can also use system variable values in expressions.SET
语句动态更改,这使您可以在不必停止和重新启动服务器的情况下修改服务器的操作。您还可以在表达式中使用系统变量值。
Setting a global system variable runtime value normally requires the 设置全局系统变量运行时值通常需SYSTEM_VARIABLES_ADMIN
privilege (or the deprecated SUPER
privilege).SYSTEM_VARIABLES_ADMIN
权限(或不推荐使用的SUPER
权限)。Setting a session system runtime variable value normally requires no special privileges and can be done by any user, although there are exceptions.设置会话系统运行时变量值通常不需要特殊权限,任何用户都可以完成,但也有例外。For more information, see Section 5.1.9.1, “System Variable Privileges”有关更多信息,请参阅第5.1.9.1节,“系统变量权限”。
There are several ways to see the names and values of system variables:有几种方法可以查看系统变量的名称和值:
To see the values that a server uses based on its compiled-in defaults and any option files that it reads, use this command:要查看服务器根据其编译的默认值和读取的任何选项文件使用的值,请使用以下命令:
mysqld --verbose --help
To see the values that a server uses based only on its compiled-in defaults, ignoring the settings in any option files, use this command:要查看服务器仅基于其编译的默认值而忽略任何选项文件中的设置所使用的值,请使用以下命令:
mysqld --no-defaults --verbose --help
To see the current values used by a running server, use the 要查看正在运行的服务器使用的当前值,请使用SHOW VARIABLES
statement or the Performance Schema system variable tables.SHOW VARIABLES
语句或性能模式系统变量表。See Section 27.12.14, “Performance Schema System Variable Tables”.请参阅第27.12.14节,“性能模式系统变量表”。
This section provides a description of each system variable. For a system variable summary table, see Section 5.1.5, “Server System Variable Reference”.本节介绍了每个系统变量。有关系统变量汇总表,请参阅第5.1.5节,“服务器系统变量参考”。For more information about manipulation of system variables, see Section 5.1.9, “Using System Variables”.有关系统变量操作的更多信息,请参阅第5.1.9节,“使用系统变量”。
For additional system variable information, see these sections:有关其他系统变量信息,请参阅以下部分:
Section 5.1.9, “Using System Variables”, discusses the syntax for setting and displaying system variable values.第5.1.9节,“使用系统变量”讨论了设置和显示系统变量值的语法。
Section 5.1.9.2, “Dynamic System Variables”, lists the variables that can be set at runtime.第5.1.9.2节,“动态系统变量”列出了可在运行时设置的变量。
Information on tuning system variables can be found in Section 5.1.1, “Configuring the Server”.有关调整系统变量的信息,请参阅第5.1.1节,“配置服务器”。
Section 15.14, “InnoDB Startup Options and System Variables”, lists 第15.14节,“InnoDB启动选项和系统变量”列出了InnoDB
system variables.InnoDB
系统变量。
Section 23.3.3.9.2, “NDB Cluster System Variables”, lists system variables which are specific to NDB Cluster.第23.3.3.9.2节,“NDB集群系统变量”列出了NDB集群特有的系统变量。
For information on server system variables specific to replication, see Section 17.1.6, “Replication and Binary Logging Options and Variables”.有关特定于复制的服务器系统变量的信息,请参阅第17.1.6节,“复制和二进制日志记录选项和变量”。
Some of the following variable descriptions refer to “enabling” or “disabling” a variable.以下一些变量描述涉及“启用”或“禁用”变量。These variables can be enabled with the 这些变量可以通过SET
statement by setting them to ON
or 1
, or disabled by setting them to OFF
or 0
. SET
语句设置为ON
或1
来启用,也可以通过设置为OFF
或0
来禁用。Boolean variables can be set at startup to the values 布尔变量可以在启动时设置为ON
, TRUE
, OFF
, and FALSE
(not case-sensitive), as well as 1
and 0
. ON
、TRUE
、OFF
和FALSE
(不区分大小写)以及1
和0
。See Section 4.2.2.4, “Program Option Modifiers”.请参阅第4.2.2.4节,“程序选项修改器”。
Some system variables control the size of buffers or caches. For a given buffer, the server might need to allocate internal data structures. These structures typically are allocated from the total memory allocated to the buffer, and the amount of space required might be platform dependent.一些系统变量控制缓冲区或缓存的大小。对于给定的缓冲区,服务器可能需要分配内部数据结构。这些结构通常是从分配给缓冲区的总内存中分配的,所需的空间量可能取决于平台。This means that when you assign a value to a system variable that controls a buffer size, the amount of space actually available might differ from the value assigned. In some cases, the amount might be less than the value assigned.这意味着,当您将值分配给控制缓冲区大小的系统变量时,实际可用的空间量可能与分配的值不同。在某些情况下,金额可能小于指定的值。It is also possible that the server adjusts a value upward. For example, if you assign a value of 0 to a variable for which the minimal value is 1024, the server sets the value to 1024.服务器也有可能向上调整一个值。例如,如果将值0分配给最小值为1024的变量,则服务器会将该值设置为1024。
Values for buffer sizes, lengths, and stack sizes are given in bytes unless otherwise specified.缓冲区大小、长度和堆栈大小的值以字节为单位,除非另有规定。
Some system variables take file name values.一些系统变量采用文件名值。Unless otherwise specified, the default file location is the data directory if the value is a relative path name. To specify the location explicitly, use an absolute path name. Suppose that the data directory is 除非另有指定,否则如果值是相对路径名,则默认文件位置为数据目录。若要明确指定位置,请使用绝对路径名。假设数据目录是/var/mysql/data
./var/mysql/data
。If a file-valued variable is given as a relative path name, it is located under 如果一个文件值变量被指定为相对路径名,那么它位于/var/mysql/data
./var/mysql/data
下。If the value is an absolute path name, its location is as given by the path name.如果该值是绝对路径名,则其位置由路径名给定。
--activate-all-roles-on-login[={OFF|ON}] |
|
activate_all_roles_on_login |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether to enable automatic activation of all granted roles when users log in to the server:当用户登录到服务器时,是否启用所有授权角色的自动激活:
If 如果启用了activate_all_roles_on_login
is enabled, the server activates all roles granted to each account at login time. activate_all_roles_on_login
,则服务器会在登录时激活授予每个帐户的所有角色。This takes precedence over default roles specified with 这优先于使用SET DEFAULT ROLE
.SET DEFAULT ROLE
指定的默认角色。
If 如果activate_all_roles_on_login
is disabled, the server activates the default roles specified with SET DEFAULT ROLE
, if any, at login time.activate_all_roles_on_login
被禁用,则服务器会在登录时激活使用SET DEFAULT ROLE
指定的默认角色(如果有的话)。
Granted roles include those granted explicitly to the user and those named in the 授予的角色包括明确授予用户的角色和在mandatory_roles
system variable value.commandory_roles
系统变量值中命名的角色。
activate_all_roles_on_login
applies only at login time, and at the beginning of execution for stored programs and views that execute in definer context. activate_all_roles_on_login
仅适用于登录时,以及在定义上下文中执行的存储程序和视图的执行开始时。To change the active roles within a session, use 要更改会话中的活动角色,请使用SET ROLE
. SET ROLE
。To change the active roles for a stored program, the program body should execute 要更改存储程序的活动角色,程序体应执行SET ROLE
.SET ROLE
。
--admin-address=addr |
|
Introduced | 8.0.14 |
admin_address |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The IP address on which to listen for TCP/IP connections on the administrative network interface (see Section 5.1.12.1, “Connection Interfaces”).在管理网络接口上侦听TCP/IP连接的IP地址(请参阅第5.1.12.1节,“连接接口”)。There is no default 没有默认的admin_address
value. If this variable is not specified at startup, the server maintains no administrative interface.admin_address
值。如果在启动时未指定此变量,则服务器不维护任何管理接口。The server also has a 服务器还有一个bind_address
system variable for configuring regular (nonadministrative) client TCP/IP connections.bind_address
系统变量,用于配置常规(非管理)客户端TCP/IP连接。See Section 5.1.12.1, “Connection Interfaces”.请参阅第5.1.12.1节,“连接接口”。
If 如果指定了admin_address
is specified, its value must satisfy these requirements:admin_address
,则其值必须满足以下要求:
The value must be a single IPv4 address, IPv6 address, or host name.该值必须是单个IPv4地址、IPv6地址或主机名。
The value cannot specify a wildcard address format (该值不能指定通配符地址格式(*
, 0.0.0.0
, or ::
).*
、0.0.0.0
或::
)。
As of MySQL 8.0.22, the value may include a network namespace specifier.从MySQL 8.0.22开始,该值可能包括网络命名空间说明符。
An IP address can be specified as an IPv4 or IPv6 address. If the value is a host name, the server resolves the name to an IP address and binds to that address.IP地址可以指定为IPv4或IPv6地址。如果该值是主机名,则服务器将该名称解析为IP地址并绑定到该地址。If a host name resolves to multiple IP addresses, the server uses the first IPv4 address if there are any, or the first IPv6 address otherwise.如果主机名解析为多个IP地址,则服务器使用第一个IPv4地址(如果有),否则使用第一个IPv6地址。
The server treats different types of addresses as follows:服务器处理不同类型的地址如下:
If the address is an IPv4-mapped address, the server accepts TCP/IP connections for that address, in either IPv4 or IPv6 format.如果该地址是IPv4映射的地址,则服务器接受该地址的IPv4或IPv6格式的TCP/IP连接。For example, if the server is bound to 例如,如果服务器绑定到::ffff:127.0.0.1
, clients can connect using --host=127.0.0.1
or --host=::ffff:127.0.0.1
.::ffff:127.0.0.1
,客户端可以使用--host=127.0.0.1
或--host=::ffff:127.0.0.1
进行连接。
If the address is a “regular” IPv4 or IPv6 address (such as 如果地址是“常规”IPv4或IPv6地址(如127.0.0.1
or ::1
), the server accepts TCP/IP connections only for that IPv4 or IPv6 address.127.0.0.1
或::1
),则服务器仅接受该IPv4或IPv6的TCP/IP连接。
These rules apply to specifying a network namespace for an address:这些规则适用于为地址指定网络命名空间:
A network namespace can be specified for an IP address or a host name.可以为IP地址或主机名指定网络命名空间。
A network namespace cannot be specified for a wildcard IP address.不能为通配符IP地址指定网络命名空间。
For a given address, the network namespace is optional. If given, it must be specified as a 对于给定的地址,网络名称空间是可选的。如果给定,则必须在地址后立即指定为/ns后缀。/
suffix immediately following the address.ns
An address with no 没有/
suffix uses the host system global namespace. The global namespace is therefore the default.ns
/ns
后缀的地址使用主机系统全局命名空间。因此,全局名称空间是默认名称空间。
An address with a 后缀为/
suffix uses the namespace named ns
ns
./ns
的地址使用名为ns
的命名空间。
The host system must support network namespaces and each named namespace must previously have been set up. Naming a nonexistent namespace produces an error.主机系统必须支持网络名称空间,并且每个命名的名称空间必须事先设置好。命名不存在的命名空间会产生错误。
For additional information about network namespaces, see Section 5.1.14, “Network Namespace Support”.有关网络命名空间的更多信息,请参阅第5.1.14节,“网络命名空间支持”。
If binding to the address fails, the server produces an error and does not start.如果绑定到地址失败,服务器将产生错误,并且不会启动。
The admin_address
system variable is similar to the bind_address
system variable that binds the server to an address for ordinary client connections, but with these differences:admin_address
系统变量类似于将服务器绑定到普通客户端连接地址的bind_address
系变量,但有以下区别:
bind_address
permits multiple addresses. bind_address
允许多个地址。admin_address
permits a single address.admin_address
允许一个地址。
bind_address
permits wildcard addresses. admin_address
does not.bind_address
允许使用通配符地址。admin_address
没有。
--admin-port=port_num |
|
Introduced | 8.0.14 |
admin_port |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 33062 |
Minimum Value | 0 |
Maximum Value | 65535 |
The TCP/IP port number to use for connections on the administrative network interface (see Section 5.1.12.1, “Connection Interfaces”).用于管理网络接口上连接的TCP/IP端口号(请参阅第5.1.12.1节,“连接接口”)。Setting this variable to 0 causes the default value to be used.将此变量设置为0将使用默认值。
Setting 如果未指定admin_port
has no effect if admin_address
is not specified because in that case the server maintains no administrative network interface.admin_address
,则设置admin_port
无效,因为在这种情况下,服务器不维护任何管理网络接口。
--admin-ssl-ca=file_name |
|
Introduced | 8.0.21 |
admin_ssl_ca |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The admin_ssl_ca
system variable is like ssl_ca
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_ca
系统变量与ssl_ca
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-ssl-capath=dir_name |
|
Introduced | 8.0.21 |
admin_ssl_capath |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Directory name |
Default Value | NULL |
The admin_ssl_capath
system variable is like ssl_capath
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_capath
系统变量与ssl_capath
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-ssl-cert=file_name |
|
Introduced | 8.0.21 |
admin_ssl_cert |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The admin_ssl_cert
system variable is like ssl_cert
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_cert
系统变量与ssl_cert
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-ssl-cipher=name |
|
Introduced | 8.0.21 |
admin_ssl_cipher |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | NULL |
The admin_ssl_cipher
system variable is like ssl_cipher
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_cipher
系统变量与ssl_cipher
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-ssl-crl=file_name |
|
Introduced | 8.0.21 |
admin_ssl_crl |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The admin_ssl_crl
system variable is like ssl_crl
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_crl
系统变量与ssl_crl
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-ssl-crlpath=dir_name |
|
Introduced | 8.0.21 |
admin_ssl_crlpath |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Directory name |
Default Value | NULL |
The admin_ssl_crlpath
system variable is like ssl_crlpath
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_crlpath
系统变量与ssl_crlpath
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-ssl-key=file_name |
|
Introduced | 8.0.21 |
admin_ssl_key |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The admin_ssl_key
system variable is like ssl_key
, except that it applies to the administrative connection interface rather than the main connection interface. admin_ssl_key
系统变量与ssl_key
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-tls-ciphersuites=ciphersuite_list |
|
Introduced | 8.0.21 |
admin_tls_ciphersuites |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | NULL |
The admin_tls_ciphersuites
system variable is like tls_ciphersuites
, except that it applies to the administrative connection interface rather than the main connection interface. admin_tls_ciphersuites
系统变量与tls_cipersuites
类似,只是它适用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
--admin-tls-version=protocol_list |
|
Introduced | 8.0.21 |
admin_tls_version |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value |
|
The admin_tls_version
system variable is like tls_version
, except that it applies to the administrative connection interface rather than the main connection interface. admin_tls_version
系统变量与tls_version
类似,只是它应用于管理连接接口而不是主连接接口。For information about configuring encryption support for the administrative interface, see Administrative Interface Support for Encrypted Connections.有关配置管理接口的加密支持的信息,请参阅加密连接的管理接口支持。
As of MySQL 8.0.26, the TLSv1 and TLSv1.1 connection protocols are deprecated and support for them is subject to removal in a future version of MySQL. See Deprecated TLS Protocols.从MySQL 8.0.26开始,TLSv1和TLSv1.1连接协议已被弃用,对它们的支持可能会在未来版本的MySQL中删除。请参阅不推荐的TLS协议。
authentication_windows_log_level
--authentication-windows-log-level=# |
|
authentication_windows_log_level |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 2 |
Minimum Value | 0 |
Maximum Value | 4 |
This variable is available only if the 仅当authentication_windows
Windows authentication plugin is enabled and debugging code is enabled. See Section 6.4.1.6, “Windows Pluggable Authentication”.authentication_windows
Windows身份验证插件已启用并且调试代码已启用时,此变量才可用。请参阅第6.4.1.6节,“Windows可插拔身份验证”。
This variable sets the logging level for the Windows authentication plugin. The following table shows the permitted values.此变量设置Windows身份验证插件的日志记录级别。下表显示了允许的值。
Value | Description |
---|---|
0 | |
1 | |
2 | |
3 | |
4 |
authentication_windows_use_principal_name
--authentication-windows-use-principal-name[={OFF|ON}] |
|
authentication_windows_use_principal_name |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
This variable is available only if the 仅当authentication_windows
Windows authentication plugin is enabled. See Section 6.4.1.6, “Windows Pluggable Authentication”.authentication_windows
Windows身份验证插件已启用时,此变量才可用。请参阅第6.4.1.6节,“Windows可插拔身份验证”。
A client that authenticates using the 使用InitSecurityContext()
function should provide a string identifying the service to which it connects (targetName
).InitSecurityContext()
函数进行身份验证的客户端应提供一个字符串,用于标识其所连接的服务(targetName
)。MySQL uses the principal name (UPN) of the account under which the server is running.MySQL使用运行服务器的帐户的主体名称(UPN)。The UPN has the form UPN具有以下形式
and need not be registered anywhere to be used. This UPN is sent by the server at the beginning of authentication handshake.user_id
@computer_name
user_id@computer_name
并且不需要在任何地方注册即可使用。此UPN由服务器在身份验证握手开始时发送。
This variable controls whether the server sends the UPN in the initial challenge. By default, the variable is enabled. For security reasons, it can be disabled to avoid sending the server's account name to a client as cleartext.此变量控一致性务器是否在初始质询中发送UPN。默认情况下,变量处于启用状态。出于安全原因,可以禁用它以避免将服务器的帐户名作为明文发送到客户端。If the variable is disabled, the server always sends a 如果禁用了该变量,则服务器总是在第一个质询中发送0x00
byte in the first challenge, the client does not specify targetName
, and as a result, NTLM authentication is used.0x00
字节,客户端不指定targetName
,因此使用NTLM身份验证。
If the server fails to obtain its UPN (which happens primarily in environments that do not support Kerberos authentication), the UPN is not sent by the server and NTLM authentication is used.如果服务器无法获取其UPN(这种情况主要发生在不支持Kerberos身份验证的环境中),则服务器不会发送UPN,而是使用NTLM身份验证。
--autocommit[={OFF|ON}] |
|
autocommit |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
The autocommit mode. If set to 1, all changes to a table take effect immediately.自动提交模式。如果设置为1,则对表的所有更改都将立即生效。If set to 0, you must use COMMIT
to accept a transaction or ROLLBACK
to cancel it. If autocommit
is 0 and you change it to 1, MySQL performs an automatic COMMIT
of any open transaction. Another way to begin a transaction is to use a START TRANSACTION
or BEGIN
statement. See Section 13.3.1, “START TRANSACTION, COMMIT, and ROLLBACK Statements”.
By default, client connections begin with autocommit
set to 1. To cause clients to begin with a default of 0, set the global autocommit
value by starting the server with the --autocommit=0
option. To set the variable using an option file, include these lines:
[mysqld] autocommit=0
--automatic-sp-privileges[={OFF|ON}] |
|
automatic_sp_privileges |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
When this variable has a value of 1 (the default), the server automatically grants the EXECUTE
and ALTER ROUTINE
privileges to the creator of a stored routine, if the user cannot already execute and alter or drop the routine. (The ALTER ROUTINE
privilege is required to drop the routine.) The server also automatically drops those privileges from the creator when the routine is dropped. If automatic_sp_privileges
is 0, the server does not automatically add or drop these privileges.
The creator of a routine is the account used to execute the CREATE
statement for it. This might not be the same as the account named as the DEFINER
in the routine definition.
If you start mysqld with --skip-new
, automatic_sp_privileges
is set to OFF
.
See also Section 25.2.2, “Stored Routines and MySQL Privileges”.
--auto-generate-certs[={OFF|ON}] |
|
auto_generate_certs |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
This variable controls whether the server autogenerates SSL key and certificate files in the data directory, if they do not already exist.此变量控一致性务器是否在数据目录中自动生成SSL密钥和证书文件(如果它们还不存在)。
At startup, the server automatically generates server-side and client-side SSL certificate and key files in the data directory if the 启动时,如果启用了auto_generate_certs
system variable is enabled, no SSL options other than --ssl
are specified, and the server-side SSL files are missing from the data directory. auto_generate_certs
系统变量,未指定--ssl
以外的SSL选项,并且数据目录中缺少服务器端SSL文件,则服务器会自动在数据目录中生成服务器端和客户端SSL证书和密钥文件。These files enable secure client connections using SSL; see Section 6.3.1, “Configuring MySQL to Use Encrypted Connections”.这些文件使用SSL实现安全的客户端连接;请参阅第6.3.1节,“配置MySQL以使用加密连接”。
For more information about SSL file autogeneration, including file names and characteristics, see Section 6.3.3.1, “Creating SSL and RSA Certificates and Keys using MySQL”有关SSL文件自动生成的更多信息,包括文件名和特征,请参阅第6.3.3.1节,“使用MySQL创建SSL和RSA证书和密钥”。
The sha256_password_auto_generate_rsa_keys
and caching_sha2_password_auto_generate_rsa_keys
system variables are related but control autogeneration of RSA key-pair files needed for secure password exchange using RSA over unencypted connections.sha256_password_auto_generate_rsa_keys
和caching_sha2_password_auto_generate_rsa_keys
系统变量是相关的,但控制在未加密连接上使用rsa进行安全密码交换所需的rsa密钥对文件的自动生成。
--avoid-temporal-upgrade[={OFF|ON}] |
|
Deprecated | Yes |
avoid_temporal_upgrade |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable controls whether ALTER TABLE
implicitly upgrades temporal columns found to be in pre-5.6.4 format (TIME
, DATETIME
, and TIMESTAMP
columns without support for fractional seconds precision). Upgrading such columns requires a table rebuild, which prevents any use of fast alterations that might otherwise apply to the operation to be performed.
This variable is disabled by default. Enabling it causes 默认情况下,此变量处于禁用状态。启用它会导致ALTER TABLE
not to rebuild temporal columns and thereby be able to take advantage of possible fast alterations.ALTER TABLE
不重新生成临时列,从而能够利用可能的快速更改。
This variable is deprecated; expect it to be removed in a future MySQL release.此变量已弃用;期望它在未来的MySQL版本中被删除。
--back-log=# |
|
back_log |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | -1 |
Minimum Value | 1 |
Maximum Value | 65535 |
The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time. It then takes some time (although very little) for the main thread to check the connection and start a new thread.MySQL可以具有的未完成连接请求数。当MySQL主线程在很短的时间内收到很多连接请求时,这一点就会发挥作用。然后,主线程需要一些时间(尽管很短)来检查连接并启动一个新线程。The back_log
value indicates how many requests can be stacked during this short time before MySQL momentarily stops answering new requests. You need to increase this only if you expect a large number of connections in a short period of time.back_log
值表示在MySQL暂时停止响应新请求之前的短时间内可以堆叠多少请求。只有当您预计在短时间内会有大量连接时,才需要增加此值。
In other words, this value is the size of the listen queue for incoming TCP/IP connections.换句话说,此值是传入TCP/IP连接的侦听队列的大小。Your operating system has its own limit on the size of this queue.您的操作系统对此队列的大小有自己的限制。The manual page for the Unix Unix listen()
system call should have more details.list()
系统调用的手册页应该有更多详细信息。Check your OS documentation for the maximum value for this variable.有关此变量的最大值,请查看您的操作系统文档。back_log
cannot be set higher than your operating system limit.不能设置得高于您的操作系统限制。
The default value is the value of 默认值是max_connections
, which enables the permitted backlog to adjust to the maximum permitted number of connections.max_connections
的值,它使允许的囤积能够调整到允许的最大连接数。
--basedir=dir_name |
|
basedir |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Directory name |
Default Value | parent of mysqld installation directory |
The path to the MySQL installation base directory.MySQL安装基本目录的路径。
--big-tables[={OFF|ON}] |
|
big_tables |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If enabled, the server stores all temporary tables on disk rather than in memory. This prevents most The table
errors for tbl_name
is fullSELECT
operations that require a large temporary table, but also slows down queries for which in-memory tables would suffice.
The default value for new connections is OFF
(use in-memory temporary tables). Normally, it should never be necessary to enable this variable. When in-memory internal temporary tables are managed by the TempTable
storage engine (the default), and the maximum amount of memory that can be occupied by the TempTable
storage engine is exceeded, the TempTable
storage engine starts storing data to temporary files on disk. When in-memory temporary tables are managed by the MEMORY
storage engine, in-memory tables are automatically converted to disk-based tables as required. For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.
--bind-address=addr |
|
bind_address |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value | * |
The MySQL server listens on one or more network sockets for TCP/IP connections. Each socket is bound to one address, but it is possible for an address to map onto multiple network interfaces.MySQL服务器在一个或多个网络套接字上侦听TCP/IP连接。每个套接字绑定到一个地址,但一个地址可以映射到多个网络接口。To specify how the server should listen for TCP/IP connections, set the bind_address
system variable at server startup. The server also has an admin_address
system variable that enables administrative connections on a dedicated interface. See Section 5.1.12.1, “Connection Interfaces”.
If 如果指定了bind_address
is specified, its value must satisfy these requirements:bind_address
,则其值必须满足以下要求:
Prior to MySQL 8.0.13, bind_address
accepts a single address value, which may specify a single non-wildcard IP address or host name, or one of the wildcard address formats that permit listening on multiple network interfaces (*
, 0.0.0.0
, or ::
).
As of MySQL 8.0.13, bind_address
accepts either a single value as just described, or a list of comma-separated values. When the variable names a list of multiple values, each value must specify a single non-wildcard IP address (either IPv4 or IPv6) or a host name. Wildcard address formats (*
, 0.0.0.0
, or ::
) are not allowed in a list of values.
As of MySQL 8.0.22, addresses may include a network namespace specifier.从MySQL 8.0.22开始,地址可能包括网络命名空间说明符。
IP addresses can be specified as IPv4 or IPv6 addresses. For any value that is a host name, the server resolves the name to an IP address and binds to that address.IP地址可以指定为IPv4或IPv6地址。对于任何主机名值,服务器都会将名称解析为IP地址并绑定到该地址。If a host name resolves to multiple IP addresses, the server uses the first IPv4 address if there are any, or the first IPv6 address otherwise.如果主机名解析为多个IP地址,则服务器使用第一个IPv4地址(如果有),否则使用第一个IPv6地址。
The server treats different types of addresses as follows:服务器处理不同类型的地址如下:
If the address is 如果地址为*
, the server accepts TCP/IP connections on all server host IPv4 interfaces, and, if the server host supports IPv6, on all IPv6 interfaces. Use this address to permit both IPv4 and IPv6 connections on all server interfaces.*
,则服务器接受所有服务器主机IPv4接口上的TCP/IP连接,如果服务器主机支持IPv6,则接受所有IPv6接口上的TCP/IP连接。使用此地址可以允许在所有服务器接口上进行IPv4和IPv6连接。This value is the default. If the variable specifies a list of multiple values, this value is not permitted.此值为默认值。如果变量指定了多个值的列表,则不允许使用此值。
If the address is 如果地址为0.0.0.0
, the server accepts TCP/IP connections on all server host IPv4 interfaces. If the variable specifies a list of multiple values, this value is not permitted.0.0.0.0
,则服务器接受所有服务器主机IPv4接口上的TCP/IP连接。如果变量指定了多个值的列表,则不允许使用此值。
If the address is 如果地址为::
, the server accepts TCP/IP connections on all server host IPv4 and IPv6 interfaces. If the variable specifies a list of multiple values, this value is not permitted.::
,则服务器接受所有服务器主机IPv4和IPv6接口上的TCP/IP连接。如果变量指定了多个值的列表,则不允许使用此值。
If the address is an IPv4-mapped address, the server accepts TCP/IP connections for that address, in either IPv4 or IPv6 format.如果该地址是IPv4映射的地址,则服务器接受该地址的IPv4或IPv6格式的TCP/IP连接。For example, if the server is bound to ::ffff:127.0.0.1
, clients can connect using --host=127.0.0.1
or --host=::ffff:127.0.0.1
.
If the address is a “regular” IPv4 or IPv6 address (such as 如果地址是“常规”IPv4或IPv6地址(如127.0.0.1
or ::1
), the server accepts TCP/IP connections only for that IPv4 or IPv6 address.127.0.0.1
或::1
),则服务器仅接受该IPv4或IPv6的TCP/IP连接。
These rules apply to specifying a network namespace for an address:这些规则适用于为地址指定网络命名空间:
A network namespace can be specified for an IP address or a host name.可以为IP地址或主机名指定网络命名空间。
A network namespace cannot be specified for a wildcard IP address.不能为通配符IP地址指定网络命名空间。
For a given address, the network namespace is optional. If given, it must be specified as a 对于给定的地址,网络名称空间是可选的。如果给定,则必须在地址后立即指定为/
suffix immediately following the address.ns
/ns
后缀。
An address with no 没有/
suffix uses the host system global namespace. The global namespace is therefore the default.ns
/ns
后缀的地址使用主机系统全局命名空间。因此,全局名称空间是默认名称空间。
An address with a 后缀为/
suffix uses the namespace named ns
ns
./ns
的地址使用名为ns
的命名空间。
The host system must support network namespaces and each named namespace must previously have been set up. Naming a nonexistent namespace produces an error.主机系统必须支持网络名称空间,并且每个命名的名称空间必须事先设置好。命名不存在的命名空间会产生错误。
If the variable value specifies multiple addresses, it can include addresses in the global namespace, in named namespaces, or a mix.如果变量值指定了多个地址,则它可以包括全局名称空间、命名名称空间或混合名称空间中的地址。
For additional information about network namespaces, see Section 5.1.14, “Network Namespace Support”.有关网络命名空间的更多信息,请参阅第5.1.14节,“网络命名空间支持”。
If binding to any address fails, the server produces an error and does not start.如果绑定到任何地址失败,服务器将产生错误并且不会启动。
Examples:示例:
bind_address=*
The server listens on all IPv4 or IPv6 addresses, as specified by the 服务器侦听由*
wildcard.*
通配符指定的所有IPv4或IPv6地址。
bind_address=198.51.100.20
The server listens only on the 服务器仅侦听198.51.100.20
IPv4 address.198.51.100.20
IPv4地址。
bind_address=198.51.100.20,2001:db8:0:f101::1
The server listens on the 服务器侦听198.51.100.20
IPv4 address and the 2001:db8:0:f101::1
IPv6 address.198.51.100.20
IPv4地址和2001:db8:0:f101::1
IPv6地址。
bind_address=198.51.100.20,*
This produces an error because wildcard addresses are not permitted when 这会产生一个错误,因为bind_address
names a list of multiple values.bind_address
命名多个值的列表时不允许使用通配符地址。
bind_address=198.51.100.20/red,2001:db8:0:f101::1/blue,192.0.2.50
The server listens on the 198.51.100.20
IPv4 address in the red
namespace, the 2001:db8:0:f101::1
IPv6 address in the blue
namespace, and the 192.0.2.50
IPv4 address in the global namespace.
When 当bind_address
names a single value (wildcard or non-wildcard), the server listens on a single socket, which for a wildcard address may be bound to multiple network interfaces. bind_address
命名单个值(通配符或非通配符)时,服务器侦听单个套接字,对于通配符地址,该套接字可能绑定到多个网络接口。When 当bind_address
names a list of multiple values, the server listens on one socket per value, with each socket bound to a single network interface. bind_address
命名多个值的列表时,服务器会侦听每个值一个套接字,每个套接字绑定到一个网络接口。The number of sockets is linear with the number of values specified. Depending on operating system connection-acceptance efficiency, long value lists might incur a performance penalty for accepting TCP/IP connections.套接字的数量与指定的值的数量成线性关系。根据操作系统连接接受效率的不同,长值列表可能会因接受TCP/IP连接而导致性能损失。
Because file descriptors are allocated for listening sockets and network namespace files, it may be necessary to increase the 由于文件描述符是为侦听套接字和网络命名空间文件分配的,因此可能需要增加open_files_limit
system variable.open_files_limit
系统变量。
If you intend to bind the server to a specific address, be sure that the 如果您打算将服务器绑定到特定地址,请确保mysql.user
system table contains an account with administrative privileges that you can use to connect to that address.mysql.user
系统表包含一个具有管理权限的帐户,您可以使用该帐户连接到该地址。Otherwise, you cannot shut down the server.否则,无法关闭服务器。For example, if you bind the server to 例如,如果将服务器绑定到*
, you can connect to it using all existing accounts.*
,则可以使用所有现有帐户连接到它。But if you bind the server to ::1
, it accepts connections only on that address. In that case, first make sure that the 'root'@'::1'
account is present in the mysql.user
table so you can still connect to the server to shut it down.
--block-encryption-mode=# |
|
block_encryption_mode |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | aes-128-ecb |
This variable controls the block encryption mode for block-based algorithms such as AES.此变量控制诸如AES之类的基于块的算法的块加密模式。It affects encryption for 它会影响AES_ENCRYPT()
and AES_DECRYPT()
.AES_ENCRYPT()
和AES_DECRYPT()
的加密。
block_encryption_mode
takes a value in aes-
format, where keylen
-mode
keylen
is the key length in bits and mode
is the encryption mode. The value is not case-sensitive. Permitted keylen
values are 128, 192, and 256. Permitted mode
values are ECB
, CBC
, CFB1
, CFB8
, CFB128
, and OFB
.
For example, this statement causes the AES encryption functions to use a key length of 256 bits and the CBC mode:例如,此语句使AES加密函数使用256位的密钥长度和CBC模式:
SET block_encryption_mode = 'aes-256-cbc';
An error occurs for attempts to set 尝试将block_encryption_mode
to a value containing an unsupported key length or a mode that the SSL library does not support.block_encryption_mode
设置为包含不支持的密钥长度的值或SSL库不支持的模式时出错。
--bulk-insert-buffer-size=# |
|
bulk_insert_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 8388608 |
Minimum Value | 0 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
MyISAM
uses a special tree-like cache to make bulk inserts faster for INSERT ... SELECT
, INSERT ... VALUES (...), (...), ...
, and LOAD DATA
when adding data to nonempty tables. This variable limits the size of the cache tree in bytes per thread.此变量限制缓存树的大小(以每个线程的字节为单位)。Setting it to 0 disables this optimization. The default value is 8MB.将其设置为0将禁用此优化。默认值为8MB。
As of MySQL 8.0.14, setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables. See Section 5.1.9.1, “System Variable Privileges”.从MySQL 8.0.14开始,设置此系统变量的会话值是一项受限制的操作。会话用户必须具有足够的权限来设置受限制的会话变量。参见第5.1.9.1节,“系统变量权限”。
caching_sha2_password_digest_rounds
--caching-sha2-password-digest-rounds=# |
|
Introduced | 8.0.24 |
caching_sha2_password_digest_rounds |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 5000 |
Minimum Value | 5000 |
Maximum Value | 4095000 |
The number of hash rounds used by the caching_sha2_password
authentication plugin for password storage.caching_sha2_password
身份验证插件用于密码存储的哈希回合数。
Increasing the number of hashing rounds above the default value incurs a performance penalty that correlates with the amount of increase:将哈希回合数增加到默认值以上会导致与增加量相关的性能损失:
Creating an account that uses the 创建使用caching_sha2_password
plugin has no impact on the client session within which the account is created, but the server must perform the hashing rounds to complete the operation.caching_sha2_password
插件的帐户不会对创建帐户的客户端会话产生影响,但服务器必须执行哈希循环才能完成操作。
For client connections that use the account, the server must perform the hashing rounds and save the result in the cache.对于使用该帐户的客户端连接,服务器必须执行哈希循环并将结果保存在缓存中。The result is longer login time for the first client connection, but not for subsequent connections. This behavior occurs after each server restart.其结果是第一个客户端连接的登录时间更长,但后续连接的登录速度则不然。此行为发生在每次服务器重新启动之后。
caching_sha2_password_auto_generate_rsa_keys
--caching-sha2-password-auto-generate-rsa-keys[={OFF|ON}] |
|
caching_sha2_password_auto_generate_rsa_keys |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
The server uses this variable to determine whether to autogenerate RSA private/public key-pair files in the data directory if they do not already exist.服务器使用此变量来确定是否在数据目录中自动生成RSA私钥/公钥对文件(如果这些文件不存在)。
At startup, the server automatically generates RSA private/public key-pair files in the data directory if all of these conditions are true: The 启动时,如果所有这些条件都成立,服务器会自动在数据目录中生成RSA私钥/公钥对文件:sha256_password_auto_generate_rsa_keys
or caching_sha2_password_auto_generate_rsa_keys
system variable is enabled; no RSA options are specified; the RSA files are missing from the data directory.sha256_password_auto_generate_RSA_keys
或caching_sha2_password_auto_generate_rsa_keys
系统变量已启用;没有指定RSA选项;数据目录中缺少RSA文件。These key-pair files enable secure password exchange using RSA over unencrypted connections for accounts authenticated by the 这些密钥对文件使通过sha256_password
or caching_sha2_password
plugin; see Section 6.4.1.3, “SHA-256 Pluggable Authentication”, and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.sha256_password
或caching_sha2_password
插件验证的帐户能够通过未加密的连接使用RSA进行安全的密码交换;请参阅第6.4.1.3节,“SHA-256可插拔身份验证”和第6.4.1.2节,“缓存SHA-2可插拔身份认证”。
For more information about RSA file autogeneration, including file names and characteristics, see Section 6.3.3.1, “Creating SSL and RSA Certificates and Keys using MySQL”有关RSA文件自动生成的更多信息,包括文件名和特征,请参阅第6.3.3.1节,“使用MySQL创建SSL和RSA证书和密钥”。
The auto_generate_certs
system variable is related but controls autogeneration of SSL certificate and key files needed for secure connections using SSL.auto_generate_certs
系统变量是相关的,但控制使用SSL进行安全连接所需的SSL证书和密钥文件的自动生成。
caching_sha2_password_private_key_path
--caching-sha2-password-private-key-path=file_name |
|
caching_sha2_password_private_key_path |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | private_key.pem |
This variable specifies the path name of the RSA private key file for the 此变量指定caching_sha2_password
authentication plugin. If the file is named as a relative path, it is interpreted relative to the server data directory. The file must be in PEM format.caching_sha2_password
身份验证插件的RSA私钥文件的路径名。如果将文件命名为相对路径,则会将其解释为相对于服务器数据目录。文件必须为PEM格式。
Because this file stores a private key, its access mode should be restricted so that only the MySQL server can read it.因为这个文件存储了一个私钥,所以它的访问模式应该受到限制,这样只有MySQL服务器才能读取它。
For information about 有关caching_sha2_password
, see Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.caching_sha2_password
的信息,请参阅第6.4.1.2节,“缓存SHA-2可插拔身份验证”。
caching_sha2_password_public_key_path
--caching-sha2-password-public-key-path=file_name |
|
caching_sha2_password_public_key_path |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | public_key.pem |
This variable specifies the path name of the RSA public key file for the 此变量指定caching_sha2_password
authentication plugin. If the file is named as a relative path, it is interpreted relative to the server data directory. The file must be in PEM format.caching_sha2_password
身份验证插件的RSA公钥文件的路径名。如果将文件命名为相对路径,则会将其解释为相对于服务器数据目录。文件必须为PEM格式。
For information about 有关caching_sha2_password
, including information about how clients request the RSA public key, see Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.caching_sha2_password
的信息,包括有关客户端如何请求RSA公钥的信息,请参阅第6.4.1.2节,“缓存SHA-2可插拔身份验证”。
character_set_client |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4 |
The character set for statements that arrive from the client. The session value of this variable is set using the character set requested by the client when the client connects to the server.从客户端到达的语句的字符集。此变量的会话值是使用客户端连接到服务器时客户端请求的字符集设置的。(Many clients support a (许多客户端支持--default字符集选项,以便显式指定此字符集。另请参阅第10.4节,“连接字符集和排序规则”。)--default-character-set
option to enable this character set to be specified explicitly. See also Section 10.4, “Connection Character Sets and Collations”.)The global value of the variable is used to set the session value in cases when the client-requested value is unknown or not available, or the server is configured to ignore client requests:当客户端请求的值未知或不可用,或者服务器配置为忽略客户端请求时,变量的全局值用于设置会话值:
The client requests a character set not known to the server. For example, a Japanese-enabled client requests 客户端请求服务器未知的字符集。例如,启用日语的客户端在连接到未配置sjis
when connecting to a server not configured with sjis
support.sjis
支持的服务器时请求sjis
。
The client is from a version of MySQL older than MySQL 4.1, and thus does not request a character set.客户端来自MySQL 4.1之前的MySQL版本,因此不请求字符集。
mysqld was started with the mysqld是从--skip-character-set-client-handshake
option, which causes it to ignore client character set configuration.--skip-character-set-client-handshake
选项开始的,这会导致它忽略客户端字符集配置。This reproduces MySQL 4.0 behavior and is useful should you wish to upgrade the server without upgrading all the clients.这再现了MySQL 4.0的行为,如果您希望在不升级所有客户端的情况下升级服务器,这将非常有用。
Some character sets cannot be used as the client character set.某些字符集不能用作客户端字符集。Attempting to use them as the 试图将它们用作character_set_client
value produces an error.character_set_client
值会产生错误。See Impermissible Client Character Sets.请参见不允许的客户端字符集。
character_set_connection |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4 |
The character set used for literals specified without a character set introducer and for number-to-string conversion.用于在没有字符集导入器的情况下指定的文字以及用于数字到字符串转换的字符集。For information about introducers, see Section 10.3.8, “Character Set Introducers”.有关介绍人的信息,请参阅第10.3.8节,“字符集介绍人”。
character_set_database |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4 |
Footnote |
The character set used by the default database. The server sets this variable whenever the default database changes.默认数据库使用的字符集。每当默认数据库发生更改时,服务器都会设置此变量。If there is no default database, the variable has the same value as 如果没有默认数据库,则变量的值与character_set_server
.character_set_server
的值相同。
As of MySQL 8.0.14, setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables.从MySQL 8.0.14开始,设置此系统变量的会话值是一项受限制的操作。会话用户必须具有足够的权限来设置受限制的会话变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
The global 不赞成使用全局character_set_database
and collation_database
system variables are deprecated; expect them to be removed in a future version of MySQL.character_set_database
和collating_database
系统变量;预期它们在MySQL的未来版本中被删除。
Assigning a value to the session 不赞成将值分配给会话character_set_database
and collation_database
system variables is deprecated and assignments produce a warning.character_set_database
和colloration_database
系统变量,并且分配会产生警告。Expect the session variables to become read-only (and assignments to them to produce an error) in a future version of MySQL in which it remains possible to access the session variables to determine the database character set and collation for the default database.在MySQL的未来版本中,预计会话变量将变为只读(并且对它们的赋值会产生错误),在该版本中,仍然可以访问会话变量来确定默认数据库的数据库字符集和排序规则。
--character-set-filesystem=name |
|
character_set_filesystem |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | binary |
The file system character set. This variable is used to interpret string literals that refer to file names, such as in the 文件系统字符集。此变量用于解释引用文件名的字符串文字,例如LOAD DATA
and SELECT ... INTO OUTFILE
statements and the LOAD_FILE()
function.LOAD DATA
和SELECT ... INTO OUTFILE
语句和LOAD_FILE()
函数。Such file names are converted from 在尝试打开文件之前,这些文件名会从character_set_client
to character_set_filesystem
before the file opening attempt occurs.character_set_client
转换为character_set_filesystem
。The default value is 默认值为binary
, which means that no conversion occurs. For systems on which multibyte file names are permitted, a different value may be more appropriate.binary
,这意味着不会发生转换。对于允许使用多字节文件名的系统,可能更适合使用不同的值。For example, if the system represents file names using UTF-8, set 例如,如果系统使用UTF-8表示文件名,请将character_set_filesystem
to 'utf8mb4'
.character_set_filesystem
设置为'utf8mb4'
。
As of MySQL 8.0.14, setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables. See Section 5.1.9.1, “System Variable Privileges”.从MySQL 8.0.14开始,设置此系统变量的会话值是一项受限制的操作。会话用户必须具有足够的权限来设置受限制的会话变量。参见第5.1.9.1节,“系统变量权限”。
character_set_results |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4 |
The character set used for returning query results to the client. This includes result data such as column values, result metadata such as column names, and error messages.用于向客户端返回查询结果的字符集。这包括结果数据(如列值)、结果元数据(如列名)和错误消息。
--character-set-server=name |
|
character_set_server |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4 |
The servers default character set. See Section 10.15, “Character Set Configuration”.服务器的默认字符集。请参阅第10.15节,“字符集配置”。If you set this variable, you should also set 如果设置了此变量,还应该设置collation_server
to specify the collation for the character set.collification_server
来指定字符集的排序规则。
character_set_system |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8 |
The character set used by the server for storing identifiers. The value is always 服务器用于存储标识符的字符集。该值始终为utf8
.utf8
。
--character-sets-dir=dir_name |
|
character_sets_dir |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Directory name |
The directory where character sets are installed. See Section 10.15, “Character Set Configuration”.安装字符集的目录。请参阅第10.15节,“字符集配置”。
--check-proxy-users[={OFF|ON}] |
|
check_proxy_users |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Some authentication plugins implement proxy user mapping for themselves (for example, the PAM and Windows authentication plugins). Other authentication plugins do not support proxy users by default.一些身份验证插件为自己实现代理用户映射(例如PAM和Windows身份验证插件)。默认情况下,其他身份验证插件不支持代理用户。Of these, some can request that the MySQL server itself map proxy users according to granted proxy privileges: 其中,有些人可以请求MySQL服务器本身根据授予的代理权限映射代理用户:mysql_native_password
, sha256_password
.mysql_native_password
、sha256_password
。
If the 如果启用了check_proxy_users
system variable is enabled, the server performs proxy user mapping for any authentication plugins that make such a request.check_proxy_users
系统变量,则服务器将为发出此类请求的任何身份验证插件执行代理用户映射。However, it may also be necessary to enable plugin-specific system variables to take advantage of server proxy user mapping support:然而,也可能需要启用特定于插件的系统变量,以利用服务器代理用户映射支持:
For the 对于mysql_native_password
plugin, enable mysql_native_password_proxy_users
.mysql_native_password
插件,请启用mysql_native/password_proxy_users
。
For the 对于sha256_password
plugin, enable sha256_password_proxy_users
.sha256_password
插件,请启用sha256_pass word_proxy_users
。
For information about user proxying, see Section 6.2.18, “Proxy Users”.有关用户代理的信息,请参阅第6.2.18节,“代理用户”。
collation_connection |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
The collation of the connection character set. collation_connection
is important for comparisons of literal strings. For comparisons of strings with column values, collation_connection
does not matter because columns have their own collation, which has a higher collation precedence (see Section 10.8.4, “Collation Coercibility in Expressions”).
collation_database |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4_0900_ai_ci |
Footnote |
The collation used by the default database. The server sets this variable whenever the default database changes.默认数据库使用的排序规则。每当默认数据库发生更改时,服务器都会设置此变量。If there is no default database, the variable has the same value as 如果没有默认数据库,则该变量的值与collation_server
.collation_server
的值相同。
As of MySQL 8.0.18, setting the session value of this system variable is no longer a restricted operation.从MySQL 8.0.18开始,设置此系统变量的会话值不再是一项受限制的操作。
The global 不赞成使用全局character_set_database
and collation_database
system variables are deprecated; expect them to be removed in a future version of MySQL.character_set_database
和collating_database
系统变量;期望它们在MySQL的未来版本中被删除。
Assigning a value to the session 不赞成将值分配给会话character_set_database
and collation_database
system variables is deprecated and assignments produce a warning.character_set_database
和colloration_database
系统变量,并且分配会产生警告。Expect the session variables to become read-only (and assignments to produce an error) in a future version of MySQL in which it remains possible to access the session variables to determine the database character set and collation for the default database.在MySQL的未来版本中,预计会话变量将变为只读(并且赋值会产生错误),在该版本中,仍然可以访问会话变量来确定默认数据库的数据库字符集和排序规则。
--collation-server=name |
|
collation_server |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | utf8mb4_0900_ai_ci |
The server's default collation. See Section 10.15, “Character Set Configuration”.服务器的默认排序规则。请参阅第10.15节,“字符集配置”。
--completion-type=# |
|
completion_type |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | NO_CHAIN |
Valid Values |
|
The transaction completion type. This variable can take the values shown in the following table. The variable can be assigned using either the name values or corresponding integer values.事务处理完成类型。此变量可以采用下表中所示的值。可以使用名称值或相应的整数值来分配变量。
Value | Description |
---|---|
NO_CHAIN (or 0) | COMMIT and ROLLBACK are unaffected. |
CHAIN (or 1) | COMMIT and ROLLBACK are equivalent to COMMIT AND CHAIN and ROLLBACK AND CHAIN , respectively. |
RELEASE (or 2) | COMMIT and ROLLBACK are equivalent to COMMIT RELEASE and ROLLBACK RELEASE , respectively. |
completion_type
affects transactions that begin with START TRANSACTION
or BEGIN
and end with COMMIT
or ROLLBACK
. It does not apply to implicit commits resulting from execution of the statements listed in Section 13.3.3, “Statements That Cause an Implicit Commit”. It also does not apply for XA COMMIT
, XA ROLLBACK
, or when autocommit=1
.
--concurrent-insert[=value] |
|
concurrent_insert |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | AUTO |
Valid Values |
|
If 如果为AUTO
(the default), MySQL permits INSERT
and SELECT
statements to run concurrently for MyISAM
tables that have no free blocks in the middle of the data file.AUTO
(默认值),MySQL将允许INSERT
和SELECT
语句同时运行,用于在数据文件中间没有空闲块的MyISAM
表。
This variable can take the values shown in the following table. The variable can be assigned using either the name values or corresponding integer values.此变量可以采用下表中所示的值。可以使用名称值或相应的整数值来分配变量。
Value | Description |
---|---|
NEVER (or 0) | |
AUTO (or 1) | MyISAM tables that do not have holesMyISAM 表启用并发插入 |
ALWAYS (or 2) | MyISAM tables, even those that have holes. MyISAM 表(即使是那些有孔的表)启用并发插入。 |
If you start mysqld with 如果您使用--skip-new
, concurrent_insert
is set to NEVER
.--skip-new
启动mysqld,那么concurrent_insert
将设置为NEVER
。
See also Section 8.11.3, “Concurrent Inserts”.另见第8.11.3节,“并发插入”。
--connect-timeout=# |
|
connect_timeout |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 10 |
Minimum Value | 2 |
Maximum Value | 31536000 |
The number of seconds that the mysqld server waits for a connect packet before responding with mysqld服务器在使用Bad handshake
. The default value is 10 seconds.Bad handshake
进行响应之前等待连接数据包的秒数。默认值为10秒。
Increasing the connect_timeout
value might help if clients frequently encounter errors of the form Lost connection to MySQL server at '
.XXX
', system error: errno
core_file |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether to write a core file if the server unexpectedly exits. This variable is set by the 如果服务器意外退出,是否写入核心文件。此变量由--core-file
option.--core-file
选项设置。
--create-admin-listener-thread[={OFF|ON}] |
|
Introduced | 8.0.14 |
create_admin_listener_thread |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether to use a dedicated listening thread for client connections on the administrative network interface (see Section 5.1.12.1, “Connection Interfaces”).是否对管理网络接口上的客户端连接使用专用侦听线程(请参阅第5.1.12.1节,“连接接口”)。The default is 默认为OFF
; that is, the manager thread for ordinary connections on the main interface also handles connections for the administrative interface.OFF
;也就是说,主接口上普通连接的管理器线程也处理管理接口的连接。
Depending on factors such as platform type and workload, you may find one setting for this variable yields better performance than the other setting.根据平台类型和工作负载等因素,您可能会发现此变量的一个设置比另一个设置产生更好的性能。
Setting 如果未指定create_admin_listener_thread
has no effect if admin_address
is not specified because in that case the server maintains no administrative network interface.admin_address
,则设置create_admin_listener_thread
无效,因为在这种情况下,服务器不维护任何管理网络接口。
--cte-max-recursion-depth=# |
|
cte_max_recursion_depth |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1000 |
Minimum Value | 0 |
Maximum Value | 4294967295 |
The common table expression (CTE) maximum recursion depth. The server terminates execution of any CTE that recurses more levels than the value of this variable.公共表表达式(CTE)的最大递归深度。服务器终止执行任何重复级别超过此变量值的CTE。For more information, see Limiting Common Table Expression Recursion.有关详细信息,请参阅限制公用表表达式递归。
--datadir=dir_name |
|
datadir |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Directory name |
The path to the MySQL server data directory. Relative paths are resolved with respect to the current directory.MySQL服务器数据目录的路径。相对路径是相对于当前目录解析的。If you expect the server to be started automatically (that is, in contexts for which you cannot know the current directory in advance), it is best to specify the 如果您希望服务器自动启动(也就是说,在无法提前知道当前目录的环境中),最好将datadir
value as an absolute path.datadir
值指定为绝对路径。
--debug[=debug_options] |
|
debug |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value (Unix) | d:t:i:o,/tmp/mysqld.trace |
Default Value (Windows) | d:t:i:O,\mysqld.trace |
This variable indicates the current debugging settings. It is available only for servers built with debugging support.此变量指示当前调试设置。它仅适用于使用调试支持构建的服务器。The initial value comes from the value of instances of the 初始值来自服务器启动时给定的--debug
option given at server startup. The global and session values may be set at runtime.--debug
选项实例的值。全局值和会话值可以在运行时设置。
Setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables. See Section 5.1.9.1, “System Variable Privileges”.设置此系统变量的会话值是一项受限制的操作。会话用户必须具有足够的权限来设置受限制的会话变量。参见第5.1.9.1节,“系统变量权限”。
Assigning a value that begins with 指定一个以+
or -
cause the value to added to or subtracted from the current value:+
或-
开头的值会导致该值与当前值相加或相减:
mysql>SET debug = 'T';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | T | +---------+ mysql>SET debug = '+P';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | P:T | +---------+ mysql>SET debug = '-P';
mysql>SELECT @@debug;
+---------+ | @@debug | +---------+ | T | +---------+
For more information, see Section 5.9.4, “The DBUG Package”.有关更多信息,请参阅第5.9.4节,“DBUG软件包”。
debug_sync |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
This variable is the user interface to the Debug Sync facility. Use of Debug Sync requires that MySQL be configured with the 此变量是调试同步功能的用户界面。使用调试同步需要使用-DENABLE_DEBUG_SYNC=1
CMake option (see Section 2.9.7, “MySQL Source-Configuration Options”).-DENABLE_Debug_Sync=1
选项配置MySQL(请参阅第2.9.7节,“MySQL源配置选项”)。If Debug Sync is not compiled in, this system variable is not available.如果未在中编译调试同步,则此系统变量不可用。
The global variable value is read only and indicates whether the facility is enabled.全局变量值是只读的,指示是否启用了该功能。By default, Debug Sync is disabled and the value of debug_sync
is OFF
. If the server is started with --debug-sync-timeout=
, where N
N
is a timeout value greater than 0, Debug Sync is enabled and the value of debug_sync
is ON - current signal
followed by the signal name. Also, N
becomes the default timeout for individual synchronization points.
The session value can be read by any user and has the same value as the global variable. The session value can be set to control synchronization points.会话值可以由任何用户读取,并且具有与全局变量相同的值。会话值可以设置为控制同步点。
Setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables.设置此系统变量的会话值是一项受限制的操作。会话用户必须具有足够的权限来设置受限制的会话变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.有关调试同步功能以及如何使用同步点的描述,请参阅MySQL内部:测试同步。
--default-authentication-plugin=plugin_name |
|
default_authentication_plugin |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | caching_sha2_password |
Valid Values |
|
The default authentication plugin. These values are permitted:默认的身份验证插件。这些值是允许的:
mysql_native_password
: Use MySQL native passwords; see Section 6.4.1.1, “Native Pluggable Authentication”.:使用MySQL本机密码;请参阅第6.4.1.1节,“本机可插拔身份验证”。
sha256_password
: Use SHA-256 passwords; see Section 6.4.1.3, “SHA-256 Pluggable Authentication”.:使用SHA-256密码;请参阅第6.4.1.3节,“SHA-256可插拔身份验证”。
caching_sha2_password
: Use SHA-256 passwords; see Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.:使用SHA-256密码;请参阅第6.4.1.2节,“缓存SHA-2可插拔身份验证”。
In MySQL 8.0, 在MySQL 8.0中,默认的身份验证插件是caching_sha2_password
is the default authentication plugin rather than mysql_native_password
. For information about the implications of this change for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin.caching_sha2_password
,而不是mysql_native_password
。有关此更改对服务器操作的影响以及服务器与客户端和连接器的兼容性的信息,请参阅caching_sha2_password作为首选身份验证插件。
The default_authentication_plugin
value affects these aspects of server operation:default_authentication_plugin
值会影响服务器操作的以下方面:
It determines which authentication plugin the server assigns to new accounts created by 它确定服务器将哪个身份验证插件分配给CREATE USER
and GRANT
statements that do not explicitly specify an authentication plugin.CREATE USER
和GRANT
语句创建的新帐户,这些语句没有明确指定身份验证插件。
For an account created with the following statement, the server associates the account with the default authentication plugin and assigns the account the given password, hashed as required by that plugin:对于使用以下语句创建的帐户,服务器将该帐户与默认的身份验证插件相关联,并为该帐户分配给定的密码,根据该插件的要求进行哈希处理:
CREATE USER ... IDENTIFIED BY 'cleartext password
';
default_collation_for_utf8mb4 |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Valid Values |
|
For internal use by replication. This system variable is set to the default collation for the 供复制内部使用。此系统变量设置为utf8mb4
character set.utf8mb4
字符集的默认排序规则。The value of the variable is replicated from a source to a replica so that the replica can correctly process data originating from a source with a different default collation for 变量的值从源复制到副本,以便副本可以正确处理源自具有不同默认排序规则的utf8mb4
.utf8mb4
的源的数据。This variable is primarily intended to support replication from a MySQL 5.7 or older replication source server to a MySQL 8.0 replica server, or group replication with a MySQL 5.7 primary node and one or more MySQL 8.0 secondaries.此变量主要用于支持从MySQL 5.7或更早版本的复制源服务器到MySQL 8.0副本服务器的复制,或使用MySQL 5.7主节点和一个或多个MySQL 8.0辅助节点的组复制。The default collation for MySQL 5.7中utf8mb4
in MySQL 5.7 is utf8mb4_general_ci
, but utf8mb4_0900_ai_ci
in MySQL 8.0.utf8mb4
的默认排序规则是utf8mb0_general_ci
,但是在MySQL 8.0中utf8mb4
的默认排序规则utf8mf4_0900_ai_ci
。The variable is not present in releases earlier than MySQL 8.0, so if the replica does not receive a value for the variable, it assumes the source is from an earlier release and sets the value to the previous default collation 该变量不存在于MySQL 8.0之前的版本中,因此,如果副本没有接收到该变量的值,则会假定源来自早期版本,并将该值设置为以前的默认排序规则utf8mb4_general_ci
.utf8mb4_general_ci
。
As of MySQL 8.0.18, setting the session value of this system variable is no longer a restricted operation.从MySQL 8.0.18开始,设置此系统变量的会话值不再是一项受限制的操作。
The default 以下语句中使用默认的utf8mb4
collation is used in the following statements:utf8mb4
排序规则:
CREATE TABLE
and ALTER TABLE
having a CHARACTER SET utf8mb4
clause without a COLLATION
clause, either for the table character set or for a column character set.
CREATE DATABASE
and ALTER DATABASE
having a CHARACTER SET utf8mb4
clause without a COLLATION
clause.
Any statement containing a string literal of the form _utf8mb4'
without a some text
'COLLATE
clause.
--default-password-lifetime=# |
|
default_password_lifetime |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 65535 |
This variable defines the global automatic password expiration policy.此变量定义全局自动密码过期策略。The default default_password_lifetime
value is 0, which disables automatic password expiration. If the value of default_password_lifetime
is a positive integer N
, it indicates the permitted password lifetime; passwords must be changed every N
days.
The global password expiration policy can be overridden as desired for individual accounts using the password expiration option of the CREATE USER
and ALTER USER
statements. See Section 6.2.15, “Password Management”.
--default-storage-engine=name |
|
default_storage_engine |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | InnoDB |
The default storage engine for tables.表的默认存储引擎。See Chapter 16, Alternative Storage Engines. This variable sets the storage engine for permanent tables only.请参阅第16章,“替代存储引擎”。此变量仅为永久表设置存储引擎。To set the storage engine for 要为TEMPORARY
tables, set the default_tmp_storage_engine
system variable.TEMPORARY
表设置存储引擎,请设置default_tmp_storage_engine
系统变量。
To see which storage engines are available and enabled, use the SHOW ENGINES
statement or query the INFORMATION_SCHEMA
ENGINES
table.
If you disable the default storage engine at server startup, you must set the default engine for both permanent and 如果在服务器启动时禁用默认存储引擎,则必须将永久表和TEMPORARY
tables to a different engine, or else the server does not start.TEMPORARY
表的默认引擎设置为不同的引擎,否则服务器不会启动。
--default-table-encryption[={OFF|ON}] |
|
Introduced | 8.0.16 |
default_table_encryption |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
Defines the default encryption setting applied to schemas and general tablespaces when they are created without specifying an 定义在不指定ENCRYPTION
clause.ENCRYPTION
子句的情况下创建架构和常规表空间时应用于它们的默认加密设置。
The default_table_encryption
variable is only applicable to user-created schemas and general tablespaces. It does not govern encryption of the mysql
system tablespace.
Setting the runtime value of default_table_encryption
requires the SYSTEM_VARIABLES_ADMIN
and TABLE_ENCRYPTION_ADMIN
privileges, or the deprecated SUPER
privilege.
default_table_encryption
supports SET PERSIST
and SET PERSIST_ONLY
syntax. See Section 5.1.9.3, “Persisted System Variables”.
For more information, see Defining an Encryption Default for Schemas and General Tablespaces.有关更多信息,请参阅为架构和常规表空间定义加密默认值。
--default-tmp-storage-engine=name |
|
default_tmp_storage_engine |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Enumeration |
Default Value | InnoDB |
The default storage engine for TEMPORARY
tables (created with CREATE TEMPORARY TABLE
). To set the storage engine for permanent tables, set the default_storage_engine
system variable. Also see the discussion of that variable regarding possible values.
If you disable the default storage engine at server startup, you must set the default engine for both permanent and TEMPORARY
tables to a different engine, or else the server does not start.
--default-week-format=# |
|
default_week_format |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 7 |
The default mode value to use for the 用于WEEK()
function. See Section 12.7, “Date and Time Functions”.WEEK()
函数的默认模式值。参见第12.7节,“日期和时间函数”。
--delay-key-write[={OFF|ON|ALL}] |
|
delay_key_write |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | ON |
Valid Values |
|
This variable specifies how to use delayed key writes.此变量指定如何使用延迟的密钥写入。It applies only to 它仅适用于MyISAM
tables. Delayed key writing causes key buffers not to be flushed between writes.MyISAM
表。延迟的密钥写入会导致在写入之间不刷新密钥缓冲区。See also Section 16.2.1, “MyISAM Startup Options”.另见第16.2.1节,“MyISAM启动选项”。
This variable can have one of the following values to affect handling of the 此变量可以具有以下值之一,以影响可在DELAY_KEY_WRITE
table option that can be used in CREATE TABLE
statements.CREATE TABLE
语句中使用的DELAY_KEY_WRITE
表选项的处理。
Option | Description |
---|---|
OFF | DELAY_KEY_WRITE is ignored. |
ON | MySQL honors any DELAY_KEY_WRITE option specified in CREATE TABLE statements. This is the default value. |
ALL | DELAY_KEY_WRITE option enabled.DELAY_KEY_WRITE 选项的情况下创建的。 |
If you set this variable to ALL
, you should not use MyISAM
tables from within another program (such as another MySQL server or myisamchk) when the tables are in use. Doing so leads to index corruption.
If 如果为表启用了DELAY_KEY_WRITE
is enabled for a table, the key buffer is not flushed for the table on every index update, but only when the table is closed. DELAY_KEY_WRITE
,则不会在每次索引更新时为表刷新键缓冲区,而是仅在表关闭时才刷新。This speeds up writes on keys a lot, but if you use this feature, you should add automatic checking of all 这大大加快了对键的写入速度,但如果使用此功能,则应通过使用MyISAM
tables by starting the server with the myisam_recover_options
system variable set (for example, myisam_recover_options='BACKUP,FORCE'
). myisam_recover_options
系统变量集(例如,myisam_recover_options='BACKUP,FORCE'
)启动服务器来添加对所有MyISAM
表的自动检查。See Section 5.1.8, “Server System Variables”, and Section 16.2.1, “MyISAM Startup Options”.请参阅第5.1.8节,“服务器系统变量”和第16.2.1节,“MyISAM启动选项”。
If you start mysqld with 如果使用--skip-new
, delay_key_write
is set to OFF
.--skip-new
启动mysqld,delay_key_write
将设置为OFF
。
If you enable external locking with 如果使用--external-locking
, there is no protection against index corruption for tables that use delayed key writes.--external-locking
启用外部锁定,则对于使用延迟键写入的表,就无法防止索引损坏。
--delayed-insert-limit=# |
|
Deprecated | Yes |
delayed_insert_limit |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 100 |
Minimum Value | 1 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
This system variable is deprecated (because 此系统变量已弃用(因为不支持DELAYED
inserts are not supported), and you should expect it to be removed in a future release.DELAYED
插入),您应该期望在将来的版本中删除它。
--delayed-insert-timeout=# |
|
Deprecated | Yes |
delayed_insert_timeout |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 300 |
This system variable is deprecated (because 此系统变量已弃用(因为不支持DELAYED
inserts are not supported), and you should expect it to be removed in a future release.DELAYED
插入),您应该期望在将来的版本中删除它。
--delayed-queue-size=# |
|
Deprecated | Yes |
delayed_queue_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1000 |
Minimum Value | 1 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
This system variable is deprecated (because 此系统变量已弃用(因为不支持DELAYED
inserts are not supported), and you should expect it to be removed in a future release.DELAYED
插入),您应该期望在将来的版本中删除它。
--disabled-storage-engines=engine[,engine]... |
|
disabled_storage_engines |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | 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:MyISAM
或FEDERATED
表,请在服务器选项文件中使用以下行启动服务器:
[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 ... ENGINE
or ALTER TABLESPACE ... ENGINE
to change the storage 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. default_storage_engine
或default_tmp_storage_engine
系统变量设置为禁用的存储引擎。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: --initialize
, --initialize-insecure
, --skip-grant-tables
.
Setting disabled_storage_engines
might cause an issue with mysql_upgrade. For details, see Section 4.4.5, “mysql_upgrade — Check and Upgrade MySQL Tables”.
disconnect_on_expired_password
--disconnect-on-expired-password[={OFF|ON}] |
|
disconnect_on_expired_password |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
This variable controls how the server handles clients with expired passwords:此变量控一致性务器如何处理密码过期的客户端:
If the client indicates that it can handle expired passwords, the value of 如果客户端表示可以处理过期密码,则disconnect_on_expired_password
is irrelevant. disconnect_on_expired_password
的值无关紧要。The server permits the client to connect but puts it in sandbox mode.服务器允许客户端进行连接,但将其置于沙箱模式。
If the client does not indicate that it can handle expired passwords, the server handles the client according to the value of 如果客户端没有指示可以处理过期密码,则服务器将根据disconnect_on_expired_password
:disconnect_on_expired_password
的值来处理客户端:
If 如果已启用disconnect_on_expired_password
: is enabled, the server disconnects the client.disconnect_on_expired_password
,则服务器将断开客户端的连接。
If 如果disconnect_on_expired_password
: is disabled, the server permits the client to connect but puts it in sandbox mode.disconnect_on_expired_password
被禁用,则服务器允许客户端进行连接,但将其置于沙箱模式。
For more information about the interaction of client and server settings relating to expired-password handling, see Section 6.2.16, “Server Handling of Expired Passwords”.有关与过期密码处理相关的客户端和服务器设置交互的更多信息,请参阅第6.2.16节,“过期密码的服务器处理”。
--div-precision-increment=# |
|
div_precision_increment |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 4 |
Minimum Value | 0 |
Maximum Value | 30 |
This variable indicates the number of digits by which to increase the scale of the result of division operations performed with the 此变量表示用/
operator. /
运算符执行的除法运算的结果的位数。The default value is 4. The minimum and maximum values are 0 and 30, respectively. The following example illustrates the effect of increasing the default value.默认值为4。最小值和最大值分别为0和30。以下示例说明了增加默认值的效果。
mysql>SELECT 1/7;
+--------+ | 1/7 | +--------+ | 0.1429 | +--------+ mysql>SET div_precision_increment = 12;
mysql>SELECT 1/7;
+----------------+ | 1/7 | +----------------+ | 0.142857142857 | +----------------+
dragnet.log_error_filter_rules
--dragnet.log-error-filter-rules=value |
|
dragnet.log_error_filter_rules |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | IF prio>=INFORMATION THEN drop. IF EXISTS source_line THEN unset source_line. |
The filter rules that control operation of the 控制log_filter_dragnet
error log filter component. log_filter_dragnet
错误日志筛选器组件的操作的筛选器规则。If log_filter_dragnet
is not installed, dragnet.log_error_filter_rules
is unavailable. If log_filter_dragnet
is installed but not enabled, changes to dragnet.log_error_filter_rules
have no effect.
The effect of the default value is similar to the filtering performed by the log_sink_internal
filter with a setting of log_error_verbosity=2
.
As of MySQL 8.0.12, the dragnet.Status
status variable can be consulted to determine the result of the most recent assignment to dragnet.log_error_filter_rules
.
Prior to MySQL 8.0.12, successful assignments to dragnet.log_error_filter_rules
at runtime produce a note confirming the new value:
mysql>SET GLOBAL dragnet.log_error_filter_rules = 'IF prio <> 0 THEN unset prio.';
Query OK, 0 rows affected, 1 warning (0.00 sec) mysql>SHOW WARNINGS\G
*************************** 1. row *************************** Level: Note Code: 4569 Message: filter configuration accepted: SET @@GLOBAL.dragnet.log_error_filter_rules= 'IF prio!=ERROR THEN unset prio.';
The value displayed by SHOW WARNINGS
indicates the “decompiled” canonical representation after the rule set has been successfully parsed and compiled into internal form. SHOW WARNINGS
显示的值表示规则集已成功解析并编译为内部形式后的“反编译”规范表示。Semantically, this canonical form is identical to the value assigned to 从语义上讲,此规范形式与分配给dragnet.log_error_filter_rules
, but there may be some differences between the assigned and canonical values, as illustrated by the preceding example:dragnet.log_error_filter_rules
的值相同,但分配的值和规范值之间可能存在一些差异,如前面的示例所示:
The <>
operator is changed to !=
.<>
运算符已更改为!=
。
The numeric priority of 0 is changed to the corresponding priority symbol 0的数字优先级更改为相应的优先级符号ERROR
.ERROR
。
Optional spaces are removed.可选空间将被删除。
For additional information, see Section 5.4.2.4, “Types of Error Log Filtering”, and Section 5.5.3, “Error Log Components”.有关更多信息,请参阅第5.4.2.4节,“错误日志筛选的类型”和第5.5.3节,“错误记录组件”。
--end-markers-in-json[={OFF|ON}] |
|
end_markers_in_json |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
Whether optimizer JSON output should add end markers. See MySQL Internals: The end_markers_in_json System Variable.优化器JSON输出是否应添加结束标记。请参阅MySQL内部:end_markers_in_json
系统变量。
--eq-range-index-dive-limit=# |
|
eq_range_index_dive_limit |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 200 |
Minimum Value | 0 |
Maximum Value | 4294967295 |
This variable indicates the number of equality ranges in an equality comparison condition when the optimizer should switch from using index dives to index statistics in estimating the number of qualifying rows. 当优化器在估计符合条件的行数时应从使用索引潜水切换到使用索引统计信息时,此变量指示相等比较条件中相等范围的数量。It applies to evaluation of expressions that have either of these equivalent forms, where the optimizer uses a nonunique index to look up 它适用于具有以下等效形式之一的表达式的求值,其中优化器使用非唯一索引来查找col_name
values:col_name
值:
col_name
IN(val1
, ...,valN
)col_name
=val1
OR ... ORcol_name
=valN
In both cases, the expression contains 在这两种情况下,表达式都包含N
equality ranges. The optimizer can make row estimates using index dives or index statistics. N
个相等范围。优化器可以使用索引潜水或索引统计信息进行行估计。If eq_range_index_dive_limit
is greater than 0, the optimizer uses existing index statistics instead of index dives if there are eq_range_index_dive_limit
or more equality ranges. Thus, to permit use of index dives for up to N
equality ranges, set eq_range_index_dive_limit
to N
+ 1. To disable use of index statistics and always use index dives regardless of 要禁用索引统计信息的使用并始终使用索引潜水(无论N
, set eq_range_index_dive_limit
to 0.N
),请将eq_range_index_dive_limit
设置为0。
For more information, see Equality Range Optimization of Many-Valued Comparisons.有关详细信息,请参阅多值比较的相等范围优化。
To update table index statistics for best estimates, use 要更新表索引统计信息以获得最佳估计值,请使用ANALYZE TABLE
.ANALYZE TABLE
。
The number of errors that resulted from the last statement that generated messages. 生成消息的最后一条语句所导致的错误数。This variable is read only. See Section 13.7.7.17, “SHOW ERRORS Statement”.此变量是只读的。参见第13.7.7.17节,“SHOW ERRORS语句”。
--event-scheduler[=value] |
|
event_scheduler |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | ON |
Valid Values |
|
This variable enables or disables, and starts or stops, the Event Scheduler. 此变量启用或禁用以及启动或停止事件计划程序。The possible status values are 可能的状态值为ON
, OFF
, and DISABLED
. ON
、OFF
和DISABLED
。Turning the Event Scheduler 关闭事件计划程序与禁用事件计划程序不同,后者需要将状态设置为OFF
is not the same as disabling the Event Scheduler, which requires setting the status to DISABLED
. DISABLED
。This variable and its effects on the Event Scheduler's operation are discussed in greater detail in Section 25.4.2, “Event Scheduler Configuration”在第25.4.2节,“事件调度器配置”中更详细地讨论了此变量及其对事件调度器操作的影响
explicit_defaults_for_timestamp
--explicit-defaults-for-timestamp[={OFF|ON}] |
|
Deprecated | Yes |
explicit_defaults_for_timestamp |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
This system variable determines whether the server enables certain nonstandard behaviors for default values and 此系统变量确定服务器是否为NULL
-value handling in TIMESTAMP
columns. TIMESTAMP
列中的默认值和NULL
值处理启用某些非标准行为。By default, explicit_defaults_for_timestamp
is enabled, which disables the nonstandard behaviors. Disabling explicit_defaults_for_timestamp
results in a warning.
As of MySQL 8.0.18, setting the session value of this system variable is no longer a restricted operation.从MySQL 8.0.18开始,设置此系统变量的会话值不再是一项受限制的操作。
If explicit_defaults_for_timestamp
is disabled, the server enables the nonstandard behaviors and handles TIMESTAMP
columns as follows:
TIMESTAMP
columns not explicitly declared with the NULL
attribute are automatically declared with the NOT NULL
attribute. Assigning such a column a value of NULL
is permitted and sets the column to the current timestamp. Exception: As of MySQL 8.0.22, attempting to insert 从MySQL 8.0.22开始,试图将NULL
into a generated column declared as TIMESTAMP NOT NULL
is rejected with an error.NULL
插入到声明为TIMESTAMP NOT NULL
的生成列中会被拒绝,并出现错误。
The first TIMESTAMP
column in a table, if not explicitly declared with the NULL
attribute or an explicit DEFAULT
or ON UPDATE
attribute, is automatically declared with the DEFAULT CURRENT_TIMESTAMP
and ON UPDATE CURRENT_TIMESTAMP
attributes.
TIMESTAMP
columns following the first one, if not explicitly declared with the NULL
attribute or an explicit DEFAULT
attribute, are automatically declared as DEFAULT '0000-00-00 00:00:00'
(the “zero” timestamp). For inserted rows that specify no explicit value for such a column, the column is assigned 对于未为此类列指定显式值的插入行,将为该列分配'0000-00-00 00:00:00'
and no warning occurs.'0000-00-00 00:00:00'
,并且不会出现任何警告。
Depending on whether strict SQL mode or the NO_ZERO_DATE
SQL mode is enabled, a default value of '0000-00-00 00:00:00'
may be invalid. Be aware that the TRADITIONAL
SQL mode includes strict mode and NO_ZERO_DATE
. See Section 5.1.11, “Server SQL Modes”.请参阅第5.1.11节,“服务器SQL模式”。
The nonstandard behaviors just described are deprecated; expect them to be removed in a future MySQL release.不赞成使用刚才描述的不规范行为;期望它们在未来的MySQL版本中被删除。
If explicit_defaults_for_timestamp
is enabled, the server disables the nonstandard behaviors and handles TIMESTAMP
columns as follows:
It is not possible to assign a 不能为TIMESTAMP
column a value of NULL
to set it to the current timestamp. TIMESTAMP
列分配NULL
值以将其设置为当前时间戳。To assign the current timestamp, set the column to 要分配当前时间戳,请将该列设置为CURRENT_TIMESTAMP
or a synonym such as NOW()
.CURRENT_TIMESTAMP
或类似NOW()
的同义词。
TIMESTAMP
columns not explicitly declared with the NOT NULL
attribute are automatically declared with the NULL
attribute and permit NULL
values. Assigning such a column a value of NULL
sets it to NULL
, not the current timestamp.
TIMESTAMP
columns declared with the NOT NULL
attribute do not permit NULL
values. For inserts that specify NULL
for such a column, the result is either an error for a single-row insert if strict SQL mode is enabled, or '0000-00-00 00:00:00'
is inserted for multiple-row inserts with strict SQL mode disabled. In no case does assigning the column a value of 在任何情况下,为列分配NULL
set it to the current timestamp.NULL
值都不会将其设置为当前时间戳。
TIMESTAMP
columns explicitly declared with the NOT NULL
attribute and without an explicit DEFAULT
attribute are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. 对于未为此类列指定显式值的插入行,结果取决于SQL模式。If strict SQL mode is enabled, an error occurs. If strict SQL mode is not enabled, the column is declared with the implicit default of 如果启用了严格SQL模式,则会发生错误。如果未启用严格SQL模式,则使用隐式默认值'0000-00-00 00:00:00'
and a warning occurs. '0000-00-00 00:00:00'
声明该列,并出现警告。This is similar to how MySQL treats other temporal types such as 这与MySQL处理其他时态类型(如DATETIME
.DATETIME
)的方式类似。
No TIMESTAMP
column is automatically declared with the DEFAULT CURRENT_TIMESTAMP
or ON UPDATE CURRENT_TIMESTAMP
attributes. Those attributes must be explicitly specified.必须明确指定这些属性。
The first TIMESTAMP
column in a table is not handled differently from TIMESTAMP
columns following the first one.
If explicit_defaults_for_timestamp
is disabled at server startup, this warning appears in the error log:
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
As indicated by the warning, to disable the deprecated nonstandard behaviors, enable the 如警告所示,要禁用不推荐使用的非标准行为,请在服务器启动时启用explicit_defaults_for_timestamp
system variable at server startup.explicit_defaults_for_timestamp
系统变量。
explicit_defaults_for_timestamp
is itself deprecated because its only purpose is to permit control over deprecated TIMESTAMP
behaviors that are to be removed in a future MySQL release. When removal of those behaviors occurs, expect explicit_defaults_for_timestamp
to be removed as well.
For additional information, see Section 11.2.5, “Automatic Initialization and Updating for TIMESTAMP and DATETIME”.有关更多信息,请参阅第11.2.5节,“TIMESTAMP和DATETIME的自动初始化和更新”。
external_user |
|
Session | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The external user name used during the authentication process, as set by the plugin used to authenticate the client. With native (built-in) MySQL authentication, or if the plugin does not set the value, this variable is 身份验证过程中使用的外部用户名,由用于验证客户端的插件设置。使用本机(内置)MySQL身份验证,或者如果插件没有设置值,则此变量为NULL
. NULL
。See Section 6.2.18, “Proxy Users”.请参阅第6.2.18节,“代理用户”。
--flush[={OFF|ON}] |
|
flush |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If 如果为ON
, the server flushes (synchronizes) all changes to disk after each SQL statement. ON
,则服务器会在每次SQL语句之后将所有更改刷新(同步)到磁盘。Normally, MySQL does a write of all changes to disk only after each SQL statement and lets the operating system handle the synchronizing to disk. See Section B.3.3.3, “What to Do If MySQL Keeps Crashing”. 通常,MySQL只在每条SQL语句之后将所有更改写入磁盘,并让操作系统处理与磁盘的同步。请参阅B.3.3.3节,“如果MySQL持续崩溃该怎么办”。This variable is set to ON
if you start mysqld with the --flush
option.
If flush
is enabled, the value of flush_time
does not matter and changes to flush_time
have no effect on flush behavior.
--flush-time=# |
|
flush_time |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
If this is set to a nonzero value, all tables are closed every 如果设置为非零值,则每隔flush_time
seconds to free up resources and synchronize unflushed data to disk. This option is best used only on systems with minimal resources.flush_time
秒关闭所有表,以释放资源并将未刷新的数据同步到磁盘。此选项最好仅在资源最少的系统上使用。
If flush
is enabled, the value of flush_time
does not matter and changes to flush_time
have no effect on flush behavior.
foreign_key_checks |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | ON |
If set to 1 (the default), foreign key constraints are checked. 如果设置为1(默认值),则会检查外键约束。If set to 0, foreign key constraints are ignored, with a couple of exceptions. 如果设置为0,则忽略外键约束,但有几个例外。When re-creating a table that was dropped, an error is returned if the table definition does not conform to the foreign key constraints referencing the table. 重新创建已删除的表时,如果表定义不符合引用该表的外键约束,则会返回错误。Likewise, an 同样,如果外键定义的格式不正确,ALTER TABLE
operation returns an error if a foreign key definition is incorrectly formed. ALTER TABLE
操作也会返回错误。For more information, see Section 13.1.20.5, “FOREIGN KEY Constraints”.有关更多信息,请参阅第13.1.20.5节,“FOREIGN KEY约束”。
Setting this variable has the same effect on 设置此变量对NDB
tables as it does for InnoDB
tables. NDB
表的效果与对InnoDB
表的效果相同。Typically you leave this setting enabled during normal operation, to enforce referential integrity. 通常,在正常操作期间启用此设置,以强制执行引用完整性。Disabling foreign key checking can be useful for reloading 禁用外键检查对于以不同于父/子关系所需的顺序重新加载InnoDB
tables in an order different from that required by their parent/child relationships. InnoDB
表非常有用。See Section 13.1.20.5, “FOREIGN KEY Constraints”.请参阅第13.1.20.5节,“FOREIGN KEY约束”。
Setting foreign_key_checks
to 0 also affects data definition statements: DROP SCHEMA
drops a schema even if it contains tables that have foreign keys that are referred to by tables outside the schema, and DROP TABLE
drops tables that have foreign keys that are referred to by other tables.
Setting 将foreign_key_checks
to 1 does not trigger a scan of the existing table data. foreign_key_checks
设置为1不会触发对现有表数据的扫描。Therefore, rows added to the table while foreign_key_checks = 0
are not verified for consistency.
Dropping an index required by a foreign key constraint is not permitted, even with 即使foreign_key_checks=0
. The foreign key constraint must be removed before dropping the index.foreign_key_checks=0
,也不允许删除外键约束所需的索引。在删除索引之前,必须删除外键约束。
--ft-boolean-syntax=name |
|
ft_boolean_syntax |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | + -><()~*:""&| |
The list of operators supported by boolean full-text searches performed using 使用IN BOOLEAN MODE
. See Section 12.10.2, “Boolean Full-Text Searches”.IN BOOLEAN MODE
E执行的布尔全文搜索支持的运算符列表。参见第12.10.2节,“布尔全文搜索”。
The default variable value is 默认变量值为'+ -><()~*:""&|'
. The rules for changing the value are as follows:'+ -><()~*:""&|'
。更改值的规则如下:
Operator function is determined by position within the string.运算符函数由字符串中的位置决定。
The replacement value must be 14 characters.替换值必须为14个字符。
Each character must be an ASCII nonalphanumeric character.每个字符都必须是ASCII非字母字符。
Either the first or second character must be a space.第一个或第二个字符必须是空格。
No duplicates are permitted except the phrase quoting operators in positions 11 and 12. These two characters are not required to be the same, but they are the only two that may be.除了位置11和12的短语引用运算符外,不允许重复。这两个字符不需要相同,但它们是唯一可能相同的两个字符。
Positions 10, 13, and 14 (which by default are set to :
, &
, and |
) are reserved for future extensions.
--ft-max-word-len=# |
|
ft_max_word_len |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Minimum Value | 10 |
The maximum length of the word to be included in a MyISAM
FULLTEXT
index.
FULLTEXT
indexes on MyISAM
tables must be rebuilt after changing this variable. Use REPAIR TABLE
.tbl_name
QUICK
--ft-min-word-len=# |
|
ft_min_word_len |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 4 |
Minimum Value | 1 |
The minimum length of the word to be included in a MyISAM
FULLTEXT
index.
FULLTEXT
indexes on MyISAM
tables must be rebuilt after changing this variable. Use REPAIR TABLE
.tbl_name
QUICK
--ft-query-expansion-limit=# |
|
ft_query_expansion_limit |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 20 |
Minimum Value | 0 |
Maximum Value | 1000 |
The number of top matches to use for full-text searches performed using WITH QUERY EXPANSION
.
--ft-stopword-file=file_name |
|
ft_stopword_file |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
The file from which to read the list of stopwords for full-text searches on MyISAM
tables. The server looks for the file in the data directory unless an absolute path name is given to specify a different directory. 服务器会在数据目录中查找文件,除非提供了一个绝对路径名来指定不同的目录。All the words from the file are used; comments are not honored. By default, a built-in list of stopwords is used (as defined in the storage/myisam/ft_static.c
file). Setting this variable to the empty string (''
) disables stopword filtering. See also Section 12.10.4, “Full-Text Stopwords”.
更改此变量或停止字文件的内容后,必须重新生成FULLTEXT
indexes on MyISAM
tables must be rebuilt after changing this variable or the contents of the stopword file. MyISAM
表上的FULLTEXT
索引。Use 使用REPAIR TABLE
.tbl_name
QUICKREPAIR TABLE tbl_name QUICK
。
--general-log[={OFF|ON}] |
|
general_log |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether the general query log is enabled. The value can be 0 (or 是否启用了常规查询日志。该值可以为0(或OFF
) to disable the log or 1 (or ON
) to enable the log. The destination for log output is controlled by the log_output
system variable; if that value is NONE
, no log entries are written even if the log is enabled.OFF
)以禁用日志,也可以为1(或ON
)以启用日志。日志输出的目的地由log_output
系统变量控制;如果该值为NONE
,则即使启用了日志,也不会写入任何日志条目。
--general-log-file=file_name |
|
general_log_file |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | host_name.log |
The name of the general query log file. The default value is
, but the initial value can be changed with the host_name
.log--general_log_file
option.
generated_random_password_length
--generated-random-password-length=# |
|
Introduced | 8.0.18 |
generated_random_password_length |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 20 |
Minimum Value | 5 |
Maximum Value | 255 |
The maximum number of characters permitted in random passwords generated for CREATE USER
, ALTER USER
, and SET PASSWORD
statements. For more information, see Random Password Generation.有关详细信息,请参阅随机密码生成。
--group-concat-max-len=# |
|
group_concat_max_len |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 1024 |
Minimum Value | 4 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
The maximum permitted result length in bytes for the GROUP_CONCAT()
function. The default is 1024.
YES
if the zlib
compression library is available to the server, NO
if not. If not, the COMPRESS()
and UNCOMPRESS()
functions cannot be used.
YES
if mysqld supports dynamic loading of plugins, NO
if not. If the value is NO
, you cannot use options such as --plugin-load
to load plugins at server startup, or the INSTALL PLUGIN
statement to load plugins at runtime.
YES
if the server supports spatial data types, NO
if not.
This variable is a synonym for 此变量是have_ssl
.have_ssl
的同义词。
As of MySQL 8.0.26, 从MySQL 8.0.26开始,have_openssl
is deprecated and subject to removal in a future MySQL version. have_openssl
已被弃用,并将在未来的MySQL版本中删除。For information about TLS properties of MySQL connection interfaces, use the 有关MySQL连接接口的TLS属性的信息,请使用tls_channel_status
table.tls_channel_status
表。
YES
if statement profiling capability is present, NO
if not. If present, the profiling
system variable controls whether this capability is enabled or disabled. See Section 13.7.7.31, “SHOW PROFILES Statement”.
This variable is deprecated and you should expect it to be removed in a future MySQL release.此变量已被弃用,您应该期待它在未来的MySQL版本中被删除。
The query cache was removed in MySQL 8.0.3. MySQL 8.0.3中删除了查询缓存。have_query_cache
is deprecated, always has a value of NO
, and you should expect it to be removed in a future MySQL release.have_query_cache
不推荐使用,它的值总是NO,您应该预期它在未来的MySQL版本中被删除。
YES
if RTREE
indexes are available, NO
if not. (These are used for spatial indexes in MyISAM
tables.)
Deprecated | 8.0.26 |
---|---|
have_ssl |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Valid Values |
|
YES
if mysqld supports SSL connections, DISABLED
if the server was compiled with SSL support, but was not started with the appropriate connection-encryption options. For more information, see Section 2.9.6, “Configuring SSL Library Support”.
As of MySQL 8.0.26, have_ssl
is deprecated and subject to removal in a future MySQL version. For information about TLS properties of MySQL connection interfaces, use the tls_channel_status
table.
have_statement_timeout |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Whether the statement execution timeout feature is available (see Statement Execution Time Optimizer Hints). The value can be 语句执行超时功能是否可用(请参阅语句执行时间优化器提示)。如果此功能使用的后台线程无法初始化,则该值可以为NO
if the background thread used by this feature could not be initialized.NO
。
YES
if symbolic link support is enabled, NO
if not. This is required on Unix for support of the DATA DIRECTORY
and INDEX DIRECTORY
table options. If the server is started with the --skip-symbolic-links
option, the value is DISABLED
.
This variable has no meaning on Windows.
Symbolic link support, along with the 不赞成使用符号链接支持以及控制它的--symbolic-links
option that controls it, is deprecated; expect these to be removed in a future version of MySQL. --symbolic-links
选项;期望在MySQL的未来版本中删除这些内容。In addition, the option is disabled by default. 此外,该选项在默认情况下处于禁用状态。The related 相关的have_symlink
system variable also is deprecated and you should expect it to be removed in a future version of MySQL.have_symlink
系统变量也被弃用,您应该期望它在MySQL的未来版本中被删除。
histogram_generation_max_mem_size
--histogram-generation-max-mem-size=# |
|
histogram_generation_max_mem_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 20000000 |
Minimum Value | 1000000 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
The maximum amount of memory available for generating histogram statistics. 可用于生成直方图统计信息的最大内存量。See Section 8.9.6, “Optimizer Statistics”, and Section 13.7.3.1, “ANALYZE TABLE Statement”.请参阅第8.9.6节,“优化器统计”和第13.7.3.1节,“ANALYZE TABLE语句”。
Setting the session value of this system variable is a restricted operation. 设置此系统变量的会话值是一项受限制的操作。The session user must have privileges sufficient to set restricted session variables. 会话用户必须具有足够的权限来设置受限制的会话变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
--host-cache-size=# |
|
host_cache_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | -1 |
Minimum Value | 0 |
Maximum Value | 65536 |
The MySQL server maintains an in-memory host cache that contains client host name and IP address information and is used to avoid Domain Name System (DNS) lookups; see Section 5.1.12.3, “DNS Lookups and the Host Cache”.MySQL服务器维护一个内存中的主机缓存,该缓存包含客户端主机名和IP地址信息,用于避免域名系统(DNS)查找;请参阅第5.1.12.3节,“DNS查找和主机缓存”。
The host_cache_size
variable controls the size of the host cache, as well as the size of the Performance Schema host_cache
table that exposes the cache contents. host_cache_size
变量控制主机缓存的大小,以及公开缓存内容的性能架构host_cache
表的大小。Setting 设置host_cache_size
has these effects:host_cache_size
具有以下效果:
Setting the size to 0 disables the host cache. With the cache disabled, the server performs a DNS lookup every time a client connects.将大小设置为0将禁用主机缓存。在禁用缓存的情况下,服务器每次连接客户端时都会执行DNS查找。
Changing the size at runtime causes an implicit host cache flushing operation that clears the host cache, truncates the 在运行时更改大小会导致隐式主机缓存刷新操作,该操作会清除主机缓存、截断host_cache
table, and unblocks any blocked hosts.host_cache
表并取消阻止任何被阻止的主机。
The default value is autosized to 128, plus 1 for a value of max_connections
up to 500, plus 1 for every increment of 20 over 500 in the max_connections
value, capped to a limit of 2000.
Using the --skip-host-cache
option is similar to setting the host_cache_size
system variable to 0, but host_cache_size
is more flexible because it can also be used to resize, enable, and disable the host cache at runtime, not just at server startup. Starting the server with --skip-host-cache
does not prevent runtime changes to the value of host_cache_size
, but such changes have no effect and the cache is not re-enabled even if host_cache_size
is set larger than 0.
The server sets this variable to the server host name at startup. The maximum length is 255 characters as of MySQL 8.0.17, per RFC 1034, and 60 characters before that.服务器在启动时将此变量设置为服务器主机名。根据RFC 1034,从MySQL 8.0.17开始,最大长度为255个字符,在此之前为60个字符。
This variable is a synonym for the last_insert_id
variable. It exists for compatibility with other database systems. You can read its value with SELECT @@identity
, and set it using SET identity
.
--init-connect=name |
|
init_connect |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
A string to be executed by the server for each client that connects. The string consists of one or more SQL statements, separated by semicolon characters.由服务器为每个连接的客户端执行的字符串。该字符串由一个或多个SQL语句组成,用分号分隔。
For users that have the CONNECTION_ADMIN
privilege (or the deprecated SUPER
privilege), the content of init_connect
is not executed. This is done so that an erroneous value for init_connect
does not prevent all clients from connecting. For example, the value might contain a statement that has a syntax error, thus causing client connections to fail. Not executing init_connect
for users that have the CONNECTION_ADMIN
or SUPER
privilege enables them to open a connection and fix the init_connect
value.
init_connect
execution is skipped for any client user with an expired password. This is done because such a user cannot execute arbitrary statements, and thus init_connect
execution fails, leaving the client unable to connect. Skipping init_connect
execution enables the user to connect and change password.
The server discards any result sets produced by statements in the value of 服务器将丢弃init_connect
.init_connect
值中的语句生成的任何结果集。
information_schema_stats_expiry
--information-schema-stats-expiry=# |
|
information_schema_stats_expiry |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 86400 |
Minimum Value | 0 |
Maximum Value | 31536000 |
Some 某些INFORMATION_SCHEMA
tables contain columns that provide table statistics:INFORMATION_SCHEMA
表包含提供表统计信息的列:
STATISTICS.CARDINALITY TABLES.AUTO_INCREMENT TABLES.AVG_ROW_LENGTH TABLES.CHECKSUM TABLES.CHECK_TIME TABLES.CREATE_TIME TABLES.DATA_FREE TABLES.DATA_LENGTH TABLES.INDEX_LENGTH TABLES.MAX_DATA_LENGTH TABLES.TABLE_ROWS TABLES.UPDATE_TIME
Those columns represent dynamic table metadata; that is, information that changes as table contents change.这些列表示动态表元数据;即随着表内容的变化而变化的信息。
By default, MySQL retrieves cached values for those columns from the mysql.index_stats
and mysql.table_stats
dictionary tables when the columns are queried, which is more efficient than retrieving statistics directly from the storage engine. If cached statistics are not available or have expired, MySQL retrieves the latest statistics from the storage engine and caches them in the mysql.index_stats
and mysql.table_stats
dictionary tables. Subsequent queries retrieve the cached statistics until the cached statistics expire.
The information_schema_stats_expiry
session variable defines the period of time before cached statistics expire. information_schema_stats_experity
会话变量定义缓存统计信息过期前的一段时间。The default is 86400 seconds (24 hours), but the time period can be extended to as much as one year.默认值为86400秒(24小时),但时间段可以延长到一年。
To update cached values at any time for a given table, use 要随时更新给定表的缓存值,请使用ANALYZE TABLE
.ANALYZE TABLE
。
To always retrieve the latest statistics directly from the storage engine and bypass cached values, set information_schema_stats_expiry
to 0
.
Querying statistics columns does not store or update statistics in the mysql.index_stats
and mysql.table_stats
dictionary tables under these circumstances:
When cached statistics have not expired.缓存的统计信息尚未过期时。
When information_schema_stats_expiry
is set to 0.
When the server is started in read_only
, super_read_only
, transaction_read_only
, or innodb_read_only
mode.
When the query also fetches Performance Schema data.当查询还获取性能模式数据时。
The statistics cache may be updated during a multiple-statement transaction before it is known whether the transaction commits. 在知道事务是否提交之前,可以在多语句事务期间更新统计缓存。As a result, the cache may contain information that does not correspond to a known committed state. 结果,高速缓存可能包含与已知提交状态不对应的信息。This can occur with autocommit=0
or after START TRANSACTION
.
information_schema_stats_expiry
is a session variable, and each client session can define its own expiration value. information_schema_stas_express
是一个会话变量,每个客户端会话都可以定义自己的过期值。Statistics that are retrieved from the storage engine and cached by one session are available to other sessions.从存储引擎中检索并由一个会话缓存的统计信息可用于其他会话。
For related information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.有关相关信息,请参阅第8.2.3节,“优化INFORMATION_SCHEMA查询”。
--init-file=file_name |
|
init_file |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
If specified, this variable names a file containing SQL statements to be read and executed during the startup process. 如果指定,此变量将命名一个文件,该文件包含要在启动过程中读取和执行的SQL语句。Prior to MySQL 8.0.18, each statement must be on a single line and should not include comments. As of MySQL 8.0.18, the acceptable format for statements in the file is expanded to support these constructs:在MySQL 8.0.18之前,每条语句必须在一行上,并且不应包含注释。从MySQL 8.0.18开始,文件中语句的可接受格式被扩展为支持以下结构:
delimiter ;
, to set the statement delimiter to the ;
character.
delimiter $$
, to set the statement delimiter to the $$
character sequence.
Multiple statements on the same line, delimited by the current delimiter.同一行上的多个语句,由当前分隔符分隔。
Multiple-line statements.多行语句。
Comments from a 从#
character to the end of the line.#
字符到行尾的注释。
Comments from a 注释从--
sequence to the end of the line.--
序列到行尾。
C-style comments from a 从/*
sequence to the following */
sequence, including over multiple lines./*
序列到后面*/
序列的C样式注释,包括多行注释。
Multiple-line string literals enclosed within either single quote ('
) or double quote ("
) characters.
If the server is started with the --initialize
or --initialize-insecure
option, it operates in bootstap mode and some functionality is unavailable that limits the statements permitted in the file. These include statements that relate to account management (such as CREATE USER
or GRANT
), replication, and global transaction identifiers. See Section 17.1.3, “Replication with Global Transaction Identifiers”.
As of MySQL 8.0.17, threads created during server startup are used for tasks such as creating the data dictionary, running upgrade procedures, and creating system tables. To ensure a stable and predictable environment, these threads are executed with the server built-in defaults for some system variables, such as sql_mode
, character_set_server
, collation_server
, completion_type
, explicit_defaults_for_timestamp
, and default_table_encryption
.
These threads are also used to execute the statements in any file specified with init_file
when starting the server, so such statements execute with the server's built-in default values for those system variables.
innodb_
xxx
InnoDB
system variables are listed in Section 15.14, “InnoDB Startup Options and System Variables”. These variables control many aspects of storage, memory use, and I/O patterns for InnoDB
tables, and are especially important now that InnoDB
is the default storage engine.
The value to be used by the following INSERT
or ALTER TABLE
statement when inserting an AUTO_INCREMENT
value. This is mainly used with the binary log.
--interactive-timeout=# |
|
interactive_timeout |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 28800 |
Minimum Value | 1 |
The number of seconds the server waits for activity on an interactive connection before closing it. 服务器在关闭交互式连接之前等待活动的秒数。An interactive client is defined as a client that uses the 交互式客户端定义为对CLIENT_INTERACTIVE
option to mysql_real_connect()
. mysql_real_connect()
使用CLIENT_INTERACTIVE
选项的客户端。See also 另请参见wait_timeout
.wait_timeout
。
internal_tmp_disk_storage_engine
--internal-tmp-disk-storage-engine=# |
|
Removed | 8.0.16 |
internal_tmp_disk_storage_engine |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | INNODB |
Valid Values |
|
In MySQL 8.0.16 and later, on-disk internal temporary tables always use the 在MySQL 8.0.16及更高版本中,磁盘上的内部临时表始终使用InnoDB
storage engine; as of MySQL 8.0.16, this variable has been removed and is thus no longer supported.InnoDB
存储引擎;从MySQL 8.0.16开始,此变量已被删除,因此不再受支持。
Prior to MySQL 8.0.16, this variable determines the storage engine used for on-disk internal temporary tables (see Storage Engine for On-Disk Internal Temporary Tables). 在MySQL 8.0.16之前,此变量确定用于磁盘上内部临时表的存储引擎(请参阅磁盘上内部暂时表的存储发动机)。Permitted values are 允许的值为MYISAM
and INNODB
(the default).MYISAM
和InnoDB
(默认值)。
internal_tmp_mem_storage_engine
--internal-tmp-mem-storage-engine=# |
|
internal_tmp_mem_storage_engine |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Enumeration |
Default Value | TempTable |
Valid Values |
|
The storage engine for in-memory internal temporary tables (see Section 8.4.4, “Internal Temporary Table Use in MySQL”). 内存中内部临时表的存储引擎(请参阅第8.4.4节,“MySQL中的内部临时表使用”)。Permitted values are 允许的值为TempTable
(the default) and MEMORY
.TempTable
(默认值)和MEMORY
。
The optimizer uses the storage engine defined by internal_tmp_mem_storage_engine
for in-memory internal temporary tables.
--join-buffer-size=# |
|
join_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 262144 |
Minimum Value | 128 |
Maximum Value (Windows) | 4294967295 |
Maximum Value (Other, 64-bit platforms) | 18446744073709547520 |
Maximum Value (Other, 32-bit platforms) | 4294967295 |
Block Size | 128 |
The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans. Normally, the best way to get fast joins is to add indexes. 用于纯索引扫描、范围索引扫描以及不使用索引并因此执行全表扫描的联接的缓冲区的最小大小。通常,获得快速联接的最佳方法是添加索引。Increase the value of 当无法添加索引时,增加join_buffer_size
to get a faster full join when adding indexes is not possible. One join buffer is allocated for each full join between two tables. join_buffer_size
的值以获得更快的完全联接。为两个表之间的每个完整联接分配一个联接缓冲区。For a complex join between several tables for which indexes are not used, multiple join buffers might be necessary.对于不使用索引的多个表之间的复杂联接,可能需要多个联接缓冲区。
Unless a Block Nested-Loop or Batched Key Access algorithm is used, there is no gain from setting the buffer larger than required to hold each matching row, and all joins allocate at least the minimum size, so use caution in setting this variable to a large value globally. 除非使用块嵌套循环或批处理密钥访问算法,否则将缓冲区设置为大于容纳每个匹配行所需的缓冲区不会带来任何好处,并且所有联接都至少分配最小大小,因此在全局范围内将此变量设置为大值时要小心。It is better to keep the global setting small and change the session setting to a larger value only in sessions that are doing large joins, or change the setting on a per-query basis by using a 最好保持全局设置较小,并仅在执行大型联接的会话中将会话设置更改为较大值,或者使用SET_VAR
optimizer hint (see Section 8.9.3, “Optimizer Hints”). SET_VAR
优化器提示按每个查询更改设置(请参见第8.9.3节,“优化器提示”)。Memory allocation time can cause substantial performance drops if the global size is larger than needed by most queries that use it.如果全局大小大于大多数使用内存分配时间的查询所需的大小,那么内存分配时间可能会导致性能大幅下降。
When Block Nested-Loop is used, a larger join buffer can be beneficial up to the point where all required columns from all rows in the first table are stored in the join buffer. This depends on the query; the optimal size may be smaller than holding all rows from the first tables.当使用块嵌套循环时,更大的联接缓冲区可能是有益的,直到第一个表中所有行的所有必需列都存储在联接缓冲区中。这取决于查询;最佳大小可以小于保持来自第一表的所有行。
When Batched Key Access is used, the value of join_buffer_size
defines how large the batch of keys is in each request to the storage engine. The larger the buffer, the more sequential access is made to the right hand table of a join operation, which can significantly improve performance.
The default is 256KB. The maximum permissible setting for 默认值为256KB。join_buffer_size
is 4GB−1. join_buffer_size
的最大允许设置为4GB1。Larger values are permitted for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB−1 with a warning).64位平台允许使用较大的值(64位Windows除外,对于64位Windows,较大的值会截断为4GB1并发出警告)。
For additional information about join buffering, see Section 8.2.1.7, “Nested-Loop Join Algorithms”. For information about Batched Key Access, see Section 8.2.1.12, “Block Nested-Loop and Batched Key Access Joins”.有关连接缓冲的更多信息,请参阅第8.2.1.7节,“嵌套循环连接算法”。有关批量密钥访问的信息,请参阅第8.2.1.12节,“块嵌套循环和批量密钥访问连接”。
--keep-files-on-create[={OFF|ON}] |
|
keep_files_on_create |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If a MyISAM
table is created with no DATA DIRECTORY
option, the .MYD
file is created in the database directory. By default, if MyISAM
finds an existing .MYD
file in this case, it overwrites it. The same applies to .MYI
files for tables created with no INDEX DIRECTORY
option. To suppress this behavior, set the keep_files_on_create
variable to ON
(1), in which case MyISAM
does not overwrite existing files and returns an error instead. The default value is OFF
(0).
If a MyISAM
table is created with a DATA DIRECTORY
or INDEX DIRECTORY
option and an existing .MYD
or .MYI
file is found, MyISAM always returns an error. It does not overwrite a file in the specified directory.它不会覆盖指定目录中的文件。
--key-buffer-size=# |
|
key_buffer_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8388608 |
Minimum Value | 8 |
Maximum Value (64-bit platforms) | OS_PER_PROCESS_LIMIT |
Maximum Value (32-bit platforms) | 4294967295 |
Index blocks for MyISAM
tables are buffered and are shared by all threads. MyISAM
表的索引块是缓冲的,并由所有线程共享。key_buffer_size
is the size of the buffer used for index blocks. The key buffer is also known as the key cache.key_buffer_size
是用于索引块的缓冲区的大小。密钥缓冲区也称为密钥缓存。
The maximum permissible setting for 在32位平台上,key_buffer_size
is 4GB−1 on 32-bit platforms. Larger values are permitted for 64-bit platforms. key_buffer_size
的最大允许设置为4GB-1。64位平台允许使用更大的值。The effective maximum size might be less, depending on your available physical RAM and per-process RAM limits imposed by your operating system or hardware platform. 有效的最大大小可能会更小,这取决于您的可用物理RAM和操作系统或硬件平台对每个进程的RAM限制。The value of this variable indicates the amount of memory requested. Internally, the server allocates as much memory as possible up to this amount, but the actual allocation might be less.此变量的值表示请求的内存量。在内部,服务器会分配尽可能多的内存,但实际分配的内存可能会更少。
You can increase the value to get better index handling for all reads and multiple writes; on a system whose primary function is to run MySQL using the 您可以增加该值以更好地处理所有读取和多次写入的索引;在一个主要功能是使用MyISAM
storage engine, 25% of the machine's total memory is an acceptable value for this variable. MyISAM
存储引擎运行MySQL的系统上,该变量可以接受机器总内存的25%。However, you should be aware that, if you make the value too large (for example, more than 50% of the machine's total memory), your system might start to page and become extremely slow. 但是,您应该注意,如果您使该值过大(例如,超过机器总内存的50%),系统可能会开始分页并变得非常缓慢。This is because MySQL relies on the operating system to perform file system caching for data reads, so you must leave some room for the file system cache. 这是因为MySQL依赖于操作系统来执行数据读取的文件系统缓存,所以必须为文件系统缓存留出一些空间。You should also consider the memory requirements of any other storage engines that you may be using in addition to 除了MyISAM
.MyISAM
之外,您还应该考虑可能使用的任何其他存储引擎的内存需求。
For even more speed when writing many rows at the same time, use 为了在同时写入多行时获得更高的速度,请使用LOCK TABLES
. See Section 8.2.5.1, “Optimizing INSERT Statements”.LOCK TABLES
。参见第8.2.5.1节,“优化INSERT语句”。
You can check the performance of the key buffer by issuing a SHOW STATUS
statement and examining the Key_read_requests
, Key_reads
, Key_write_requests
, and Key_writes
status variables. (See Section 13.7.7, “SHOW Statements”.) The Key_reads/Key_read_requests
ratio should normally be less than 0.01. The 如果您主要使用更新和删除,Key_writes/Key_write_requests
ratio is usually near 1 if you are using mostly updates and deletes, but might be much smaller if you tend to do updates that affect many rows at the same time or if you are using the DELAY_KEY_WRITE
table option.Key_writes/Key_write_requests
的比率通常接近1,但如果您倾向于同时进行影响多行的更新,或者如果您使用DELAY_KEY_WRITE
表选项,则比率可能会小得多。
The fraction of the key buffer in use can be determined using key_buffer_size
in conjunction with the Key_blocks_unused
status variable and the buffer block size, which is available from the key_cache_block_size
system variable:
1 - ((Key_blocks_unused * key_cache_block_size) / key_buffer_size)
This value is an approximation because some space in the key buffer is allocated internally for administrative structures. Factors that influence the amount of overhead for these structures include block size and pointer size. 这个值是近似值,因为密钥缓冲区中的一些空间是在内部分配给管理结构的。影响这些结构的开销量的因素包括块大小和游标大小。As block size increases, the percentage of the key buffer lost to overhead tends to decrease. Larger blocks results in a smaller number of read operations (because more keys are obtained per read), but conversely an increase in reads of keys that are not examined (if not all keys in a block are relevant to a query).随着块大小的增加,由于开销而丢失的密钥缓冲区的百分比往往会降低。较大的块会导致较少的读取操作次数(因为每次读取会获得更多的密钥),但相反,会增加未检查的密钥的读取次数(如果不是块中的所有密钥都与查询相关)。
It is possible to create multiple 可以创建多个MyISAM
key caches. The size limit of 4GB applies to each cache individually, not as a group. See Section 8.10.2, “The MyISAM Key Cache”.MyISAM
密钥缓存。4GB的大小限制单独应用于每个缓存,而不是作为一个组。请参阅第8.10.2节,“MyISAM密钥缓存”。
--key-cache-age-threshold=# |
|
key_cache_age_threshold |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 300 |
Minimum Value | 100 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
Block Size | 100 |
This value controls the demotion of buffers from the hot sublist of a key cache to the warm sublist. Lower values cause demotion to happen more quickly. 此值控制缓冲区从密钥缓存的热子列表降级到热子列表。值越低,降级发生得越快。The minimum value is 100. The default value is 300. See Section 8.10.2, “The MyISAM Key Cache”.最小值为100。默认值为300。请参阅第8.10.2节,“MyISAM密钥缓存”。
--key-cache-block-size=# |
|
key_cache_block_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1024 |
Minimum Value | 512 |
Maximum Value | 16384 |
Block Size | 512 |
The size in bytes of blocks in the key cache. The default value is 1024. 密钥缓存中块的大小(以字节为单位)。默认值为1024。See Section 8.10.2, “The MyISAM Key Cache”.请参阅第8.10.2节,“MyISAM密钥缓存”。
--key-cache-division-limit=# |
|
key_cache_division_limit |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 100 |
Minimum Value | 1 |
Maximum Value | 100 |
The division point between the hot and warm sublists of the key cache buffer list. The value is the percentage of the buffer list to use for the warm sublist. Permissible values range from 1 to 100. 密钥缓存缓冲区列表的热子列表和热子列表之间的分界点。该值是用于暖子列表的缓冲区列表的百分比。允许值的范围从1到100。The default value is 100. See Section 8.10.2, “The MyISAM Key Cache”.默认值为100。请参阅第8.10.2节,“MyISAM密钥缓存”。
large_files_support |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Whether mysqld was compiled with options for large file support.是否使用支持大文件的选项编译了mysqld。
--large-pages[={OFF|ON}] |
|
large_pages |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Platform Specific | Linux |
Type | Boolean |
Default Value | OFF |
Whether large page support is enabled (via the 是否启用大页面支持(通过--large-pages
option). See Section 8.12.3.2, “Enabling Large Page Support”.--large-pages
选项)。请参阅第8.12.3.2节,“启用大页面支持”。
large_page_size |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
If large page support is enabled, this shows the size of memory pages. Large memory pages are supported only on Linux; on other platforms, the value of this variable is always 0. See Section 8.12.3.2, “Enabling Large Page Support”.如果启用了大页面支持,则显示内存页面的大小。只有Linux才支持大内存页;在其他平台上,此变量的值始终为0。请参阅第8.12.3.2节,“启用大页面支持”。
The value to be returned from LAST_INSERT_ID()
. This is stored in the binary log when you use LAST_INSERT_ID()
in a statement that updates a table. Setting this variable does not update the value returned by the mysql_insert_id()
C API function.
--lc-messages=name |
|
lc_messages |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | en_US |
The locale to use for error messages. The default is en_US
. The server converts the argument to a language name and combines it with the value of lc_messages_dir
to produce the location for the error message file. See Section 10.12, “Setting the Error Message Language”.
--lc-messages-dir=dir_name |
|
lc_messages_dir |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Directory name |
The directory where error messages are located. 错误消息所在的目录。The server uses the value together with the value of lc_messages
to produce the location for the error message file. See Section 10.12, “Setting the Error Message Language”.
--lc-time-names=value |
|
lc_time_names |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
This variable specifies the locale that controls the language used to display day and month names and abbreviations. This variable affects the output from the DATE_FORMAT()
, DAYNAME()
and MONTHNAME()
functions. Locale names are POSIX-style values such as 'ja_JP'
or 'pt_BR'
. The default value is 'en_US'
regardless of your system's locale setting. For further information, see Section 10.16, “MySQL Server Locale Support”.
license |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value | GPL |
The type of license the server has.
--local-infile[={OFF|ON}] |
|
local_infile |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable controls server-side LOCAL
capability for LOAD DATA
statements. Depending on the local_infile
setting, the server refuses or permits local data loading by clients that have LOCAL
enabled on the client side.
To explicitly cause the server to refuse or permit LOAD DATA LOCAL
statements (regardless of how client programs and libraries are configured at build time or runtime), start mysqld with local_infile
disabled or enabled, respectively. local_infile
can also be set at runtime. For more information, see Section 6.1.6, “Security Considerations for LOAD DATA LOCAL”.
--lock-wait-timeout=# |
|
lock_wait_timeout |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 31536000 |
Minimum Value | 1 |
Maximum Value | 31536000 |
This variable specifies the timeout in seconds for attempts to acquire metadata locks. The permissible values range from 1 to 31536000 (1 year). The default is 31536000.此变量指定尝试获取元数据锁的超时时间(以秒为单位)。允许值的范围从1到31536000(1年)。默认值为31536000。
This timeout applies to all statements that use metadata locks. 此超时适用于所有使用元数据锁的语句。These include DML and DDL operations on tables, views, stored procedures, and stored functions, as well as LOCK TABLES
, FLUSH TABLES WITH READ LOCK
, and HANDLER
statements.
This timeout does not apply to implicit accesses to system tables in the mysql
database, such as grant tables modified by GRANT
or REVOKE
statements or table logging statements. The timeout does apply to system tables accessed directly, such as with SELECT
or UPDATE
.
The timeout value applies separately for each metadata lock attempt. 超时值分别应用于每次元数据锁定尝试。A given statement can require more than one lock, so it is possible for the statement to block for longer than the lock_wait_timeout
value before reporting a timeout error. When lock timeout occurs, ER_LOCK_WAIT_TIMEOUT
is reported.
lock_wait_timeout
also defines the amount of time that a LOCK INSTANCE FOR BACKUP
statement waits for a lock before giving up.
locked_in_memory |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
--log-error[=file_name] |
|
log_error |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
The default error log destination. If the destination is the console, the value is 默认的错误日志目标。如果目标是控制台,则值为stderr
. stderr
。Otherwise, the destination is a file and the 否则,目标是一个文件,log_error
value is the file name. log_error
值是文件名。See Section 5.4.2, “The Error Log”.请参阅第5.4.2节,“错误日志”。
--log-error-services=value |
|
log_error_services |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | log_filter_internal; log_sink_internal |
The components to enable for error logging. The variable may contain a list with 0, 1, or many elements. 要启用以进行错误日志记录的组件。变量可以包含一个包含0、1或多个元素的列表。In the latter case, elements may be delimited by semicolon or (as of MySQL 8.0.12) comma, optionally followed by space. 在后一种情况下,元素可以用分号或(从MySQL 8.0.12开始)逗号分隔,可以选择后跟空格。A given setting cannot use both semicolon and comma separators. Component order is significant because the server executes components in the order listed. Any loadable (not built in) component named in the log_error_services
value must first be installed with INSTALL COMPONENT
. For more information, see Section 5.4.2.1, “Error Log Configuration”.有关更多信息,请参阅第5.4.2.1节,“错误日志配置”。
--log-error-suppression-list=value |
|
Introduced | 8.0.13 |
log_error_suppression_list |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | empty string |
The log_error_suppression_list
system variable applies to events intended for the error log and specifies which events to suppress when they occur with a priority of WARNING
or INFORMATION
. For example, if a particular type of warning is considered undesirable “noise” in the error log because it occurs frequently but is not of interest, it can be suppressed. This variable affects filtering performed by the log_filter_internal
error log filter component, which is enabled by default (see Section 5.5.3, “Error Log Components”). If log_filter_internal
is disabled, log_error_suppression_list
has no effect.
The log_error_suppression_list
value may be the empty string for no suppression, or a list of one or more comma-separated values indicating the error codes to suppress. Error codes may be specified in symbolic or numeric form. A numeric code may be specified with or without the 可以指定带有或不带有MY-
prefix. MY-
前缀的数字代码。Leading zeros in the numeric part are not significant. Examples of permitted code formats:数字部分的前导零无效。允许的代码格式示例:
ER_SERVER_SHUTDOWN_COMPLETE MY-000031 000031 MY-31 31
Symbolic values are preferable to numeric values for readability and portability. For information about the permitted error symbols and numbers, see MySQL 8.0 Error Message Reference.为了可读性和可移植性,符号值比数字值更可取。有关允许的错误符号和数字的信息,请参阅MySQL 8.0错误消息参考。
The effect of log_error_suppression_list
combines with that of log_error_verbosity
. log_error_pression_list
的效果与log_error_verbosity
的效果相结合。For additional information, see Section 5.4.2.5, “Priority-Based Error Log Filtering (log_filter_internal)”.有关更多信息,请参阅第5.4.2.5节,“基于优先级的错误日志筛选(Log_filter_internal)”。
--log-error-verbosity=# |
|
log_error_verbosity |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 2 |
Minimum Value | 1 |
Maximum Value | 3 |
The log_error_verbosity
system variable specifies the verbosity for handling events intended for the error log. This variable affects filtering performed by the log_filter_internal
error log filter component, which is enabled by default (see Section 5.5.3, “Error Log Components”). If log_filter_internal
is disabled, log_error_verbosity
has no effect.
Events intended for the error log have a priority of ERROR
, WARNING
, or INFORMATION
. log_error_verbosity
controls verbosity based on which priorities to permit for messages written to the log, as shown in the following table.
log_error_verbosity Value | Permitted Message Priorities |
---|---|
1 | ERROR |
2 | ERROR , WARNING |
3 | ERROR , WARNING , INFORMATION |
There is also a priority of 还有SYSTEM
. SYSTEM
的优先级。System messages about non-error situations are printed to the error log regardless of the 无论log_error_verbosity
value. log_error_verbosity
值是多少,有关非错误情况的系统消息都会打印到错误日志中。These messages include startup and shutdown messages, and some significant changes to settings.这些消息包括启动和关闭消息,以及对设置的一些重要更改。
The effect of log_error_verbosity
combines with that of log_error_suppression_list
. For additional information, see Section 5.4.2.5, “Priority-Based Error Log Filtering (log_filter_internal)”.有关更多信息,请参阅第5.4.2.5节,“基于优先级的错误日志筛选(Log_filter_internal)”。
--log-output=name |
|
log_output |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Set |
Default Value | FILE |
Valid Values |
|
The destination or destinations for general query log and slow query log output. The value is a list one or more comma-separated words chosen from TABLE
, FILE
, and NONE
. TABLE
selects logging to the general_log
and slow_log
tables in the mysql
system schema. FILE
selects logging to log files. NONE
disables logging. If NONE
is present in the value, it takes precedence over any other words that are present. TABLE
and FILE
can both be given to select both log output destinations.
This variable selects log output destinations, but does not enable log output. To do that, enable the 此变量选择日志输出目标,但不启用日志输出。为此,请启用general_log
and slow_query_log
system variables. general_log
和slow_query_log
系统变量。For 对于FILE
logging, the general_log_file
and slow_query_log_file
system variables determine the log file locations. FILE
日志记录,general_log_file
和slow_query_log_file
系统变量确定日志文件的位置。For more information, see Section 5.4.1, “Selecting General Query Log and Slow Query Log Output Destinations”.有关更多信息,请参阅第5.4.1节,“选择常规查询日志和慢速查询日志输出目的地”。
--log-queries-not-using-indexes[={OFF|ON}] |
|
log_queries_not_using_indexes |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If you enable this variable with the slow query log enabled, queries that are expected to retrieve all rows are logged. 如果在启用慢速查询日志的情况下启用此变量,则会记录预期检索所有行的查询。See Section 5.4.5, “The Slow Query Log”. 请参阅第5.4.5节,“慢速查询日志”。This option does not necessarily mean that no index is used. For example, a query that uses a full index scan uses an index but would be logged because the index would not limit the number of rows.此选项并不一定意味着不使用索引。例如,使用完整索引扫描的查询使用索引,但会被记录,因为索引不会限制行数。
--log-raw[={OFF|ON}] |
|
log_raw |
|
Global | |
Dynamic (≥ 8.0.19) | Yes |
SET_VAR Hint Applies (≥ 8.0.19) | No |
Type | Boolean |
Default Value | OFF |
The log_raw
system variable is initially set to the value of the --log-raw
option. See the description of that option for more information. The system variable may also be set at runtime to change password masking behavior.有关详细信息,请参阅该选项的说明。还可以在运行时设置系统变量以改变密码屏蔽行为。
--log-slow-admin-statements[={OFF|ON}] |
|
log_slow_admin_statements |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Include slow administrative statements in the statements written to the slow query log. 在写入慢速查询日志的语句中包括慢速管理语句。Administrative statements include ALTER TABLE
, ANALYZE TABLE
, CHECK TABLE
, CREATE INDEX
, DROP INDEX
, OPTIMIZE TABLE
, and REPAIR TABLE
.
--log-slow-extra[={OFF|ON}] |
|
Introduced | 8.0.14 |
log_slow_extra |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If the slow query log is enabled and the output destination includes FILE
, the server writes additional fields to log file lines that provide information about slow statements. See Section 5.4.5, “The Slow Query Log”. TABLE
output is unaffected.
--log-syslog[={OFF|ON}] |
|
Deprecated | Yes (removed in 8.0.13) |
log_syslog |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
Prior to MySQL 8.0, this variable controlled whether to perform error logging to the system log (the Event Log on Windows, and 在MySQL 8.0之前,此变量控制是否将错误日志记录到系统日志(在Windows上为事件日志,在Unix和类Unix系统上为syslog
on Unix and Unix-like systems).syslog
)。
In MySQL 8.0, the log_sink_syseventlog
log component implements error logging to the system log (see Section 5.4.2.8, “Error Logging to the System Log”), so this type of logging can be enabled by adding that component to the log_error_services
system variable. log_syslog
is removed. (Prior to MySQL 8.0.13, log_syslog
exists but is deprecated and has no effect.)
--log-syslog-facility=value |
|
Removed | 8.0.13 |
log_syslog_facility |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | daemon |
This variable was removed in MySQL 8.0.13 and replaced by syseventlog.facility
.
--log-syslog-include-pid[={OFF|ON}] |
|
Removed | 8.0.13 |
log_syslog_include_pid |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
This variable was removed in MySQL 8.0.13 and replaced by syseventlog.include_pid
.
--log-syslog-tag=tag |
|
Removed | 8.0.13 |
log_syslog_tag |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | empty string |
This variable was removed in MySQL 8.0.13 and replaced by syseventlog.tag
.
--log-timestamps=# |
|
log_timestamps |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | UTC |
Valid Values |
|
This variable controls the time zone of timestamps in messages written to the error log, and in general query log and slow query log messages written to files. 此变量控制写入错误日志的消息中的时间戳的时区,以及通常写入文件的查询日志和慢速查询日志消息中的时区。It does not affect the time zone of general query log and slow query log messages written to tables (它不影响写入表(mysql.general_log
, mysql.slow_log
). mysql.general_log
、mysql.slow_log
)的常规查询日志和慢速查询日志消息的时区。Rows retrieved from those tables can be converted from the local system time zone to any desired time zone with 从这些表中检索的行可以使用CONVERT_TZ()
or by setting the session time_zone
system variable.CONVERT_TZ()
或通过设置会话time_zone
系统变量从本地系统时区转换为任何所需时区。
Permitted log_timestamps
values are UTC
(the default) and SYSTEM
(the local system time zone).
Timestamps are written using ISO 8601 / RFC 3339 format:
plus a tail value of YYYY-MM-DD
Thh:mm:ss.uuuuuu
Z
signifying Zulu time (UTC) or ±hh:mm
(an offset from UTC).
log_throttle_queries_not_using_indexes
--log-throttle-queries-not-using-indexes=# |
|
log_throttle_queries_not_using_indexes |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
If log_queries_not_using_indexes
is enabled, the log_throttle_queries_not_using_indexes
variable limits the number of such queries per minute that can be written to the slow query log. A value of 0 (the default) means “no limit”. For more information, see Section 5.4.5, “The Slow Query Log”.
--long-query-time=# |
|
long_query_time |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Numeric |
Default Value | 10 |
Minimum Value | 0 |
If a query takes longer than this many seconds, the server increments the 如果查询花费的时间超过此秒数,则服务器会递增Slow_queries
status variable. Slow_queries
状态变量。If the slow query log is enabled, the query is logged to the slow query log file. 如果启用了慢速查询日志,则会将查询记录到慢速查询日志文件中。This value is measured in real time, not CPU time, so a query that is under the threshold on a lightly loaded system might be above the threshold on a heavily loaded one. 该值是实时测量的,而不是CPU时间,因此在轻负载系统上低于阈值的查询可能在重负载系统上高于阈值。The minimum and default values of long_query_time
are 0 and 10, respectively. long_query_time
的最小值和默认值分别为0和10。The value can be specified to a resolution of microseconds. See Section 5.4.5, “The Slow Query Log”.该值可以指定为微秒的分辨率。请参阅第5.4.5节,“慢速查询日志”。
Smaller values of this variable result in more statements being considered long-running, with the result that more space is required for the slow query log. 此变量的值越小,则会有更多的语句被认为是长时间运行的,因此慢速查询日志需要更多的空间。For very small values (less than one second), the log may grow quite large in a small time. 对于非常小的值(小于1秒),日志可能会在很短的时间内增长得很大。Increasing the number of statements considered long-running may also result in false positives for the “excessive Number of Long Running Processes” alert in MySQL Enterprise Monitor, especially if Group Replication is enabled. 增加被视为长时间运行的语句数量也可能导致MySQL Enterprise Monitor中“长时间运行进程数量过多”警报的误报,尤其是在启用了组复制的情况下。For these reasons, very small values should be used in test environments only, or, in production environments, only for a short period.由于这些原因,非常小的值应该仅在测试环境中使用,或者在生产环境中仅在短时间内使用。
--low-priority-updates[={OFF|ON}] |
|
low_priority_updates |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If set to 1
, all INSERT
, UPDATE
, DELETE
, and LOCK TABLE WRITE
statements wait until there is no pending SELECT
or LOCK TABLE READ
on the affected table. The same effect can be obtained using {INSERT | REPLACE | DELETE | UPDATE} LOW_PRIORITY ...
to lower the priority of only one query. This variable affects only storage engines that use only table-level locking (such as MyISAM
, MEMORY
, and MERGE
). See Section 8.11.2, “Table Locking Issues”.
lower_case_file_system |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
This variable describes the case sensitivity of file names on the file system where the data directory is located. 此变量描述数据目录所在的文件系统上文件名的大小写敏感性。OFF
means file names are case-sensitive, ON
means they are not case-sensitive. OFF
表示文件名区分大小写,ON
表示不区分大小写。This variable is read only because it reflects a file system attribute and setting it would have no effect on the file system.此变量是只读的,因为它反映了文件系统属性,并且设置它对文件系统没有影响。
--lower-case-table-names[=#] |
|
lower_case_table_names |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 2 |
If set to 0, table names are stored as specified and comparisons are case-sensitive. 如果设置为0,则表名将按指定存储,并且比较区分大小写。If set to 1, table names are stored in lowercase on disk and comparisons are not case-sensitive. 如果设置为1,则表名以小写形式存储在磁盘上,并且比较不区分大小写。If set to 2, table names are stored as given but compared in lowercase. 如果设置为2,则表名按给定值存储,但比较时使用小写字母。This option also applies to database names and table aliases. 此选项也适用于数据库名称和表别名。For additional details, see Section 9.2.3, “Identifier Case Sensitivity”.有关更多详细信息,请参阅第9.2.3节,“标识符大小写敏感性”。
On Windows the default value is 1. On macOS, the default value is 2. On Linux, a value of 2 is not supported; the server forces the value to 0 instead.在Windows上,默认值为1。在macOS上,默认值为2。在Linux上,不支持值2;服务器将强制该值为0。
You should not set lower_case_table_names
to 0 if you are running MySQL on a system where the data directory resides on a case-insensitive file system (such as on Windows or macOS). It is an unsupported combination that could result in a hang condition when running an INSERT INTO ... SELECT ... FROM
operation with the wrong tbl_name
tbl_name
lettercase. With MyISAM
, accessing table names using different lettercases could cause index corruption.
An error message is printed and the server exits if you attempt to start the server with --lower_case_table_names=0
on a case-insensitive file system.
If you are using 如果使用InnoDB
tables, you should set this variable to 1 on all platforms to force names to be converted to lowercase.InnoDB
表,则应在所有平台上将此变量设置为1,以强制将名称转换为小写。
The setting of this variable affects the behavior of replication filtering options with regard to case sensitivity. 此变量的设置会影响复制筛选选项在区分大小写方面的行为。For more information, see Section 17.2.5, “How Servers Evaluate Replication Filtering Rules”.有关更多信息,请参阅第17.2.5节,“服务器如何评估复制筛选规则”。
It is prohibited to start the server with a lower_case_table_names
setting that is different from the setting used when the server was initialized. The restriction is necessary because collations used by various data dictionary table fields are determined by the setting defined when the server is initialized, and restarting the server with a different setting would introduce inconsistencies with respect to how identifiers are ordered and compared.这种限制是必要的,因为各种数据字典表字段使用的排序规则是由初始化服务器时定义的设置决定的,而用不同的设置重新启动服务器会导致标识符的排序和比较不一致。
It is therefore necessary to configure 因此,在初始化服务器之前,有必要将lower_case_table_names
to the desired setting before initializing the server. lower_case_table_names
配置为所需设置。In most cases, this requires configuring lower_case_table_names
in a MySQL option file before starting the MySQL server for the first time. For APT installations on Debian and Ubuntu, however, the server is initialized for you, and there is no opportunity to configure the setting in an option file beforehand. You must therefore use the debconf-set-selection
utility prior to installing MySQL using APT to enable lower_case_table_names
. To do so, run this command before installing MySQL using APT:
shell> sudo debconf-set-selections <<< "mysql-server mysql-server/lowercase-table-names select Enabled
The ability to enable lower_case_table_names
using debconf-set-selections
was added in MySQL 8.0.17. Enabling lower_case_table_names
sets the value to 1.
--mandatory-roles=value |
|
mandatory_roles |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | empty string |
Roles the server should treat as mandatory. 服务器应将角色视为强制角色。In effect, these roles are automatically granted to every user, although setting mandatory_roles
does not actually change any user accounts, and the granted roles are not visible in the mysql.role_edges
system table.
The variable value is a comma-separated list of role names. Example:变量值是以逗号分隔的角色名称列表。实例
SET PERSIST mandatory_roles = '`role1`@`%`,`role2`,role3,role4@localhost';
Setting the runtime value of mandatory_roles
requires the ROLE_ADMIN
privilege, in addition to the SYSTEM_VARIABLES_ADMIN
privilege (or the deprecated SUPER
privilege) normally required to set a global system variable runtime value.
Role names consist of a user part and host part in
format. The host part, if omitted, defaults to user_name
@host_name
%
. For additional information, see Section 6.2.5, “Specifying Role Names”.
The mandatory_roles
value is a string, so user names and host names, if quoted, must be written in a fashion permitted for quoting within quoted strings.mandatory_roles
值是一个字符串,因此如果用户名和主机名被引用,则必须以允许在被引用的字符串中引用的方式编写。
Roles named in the value of mandatory_roles
cannot be revoked with REVOKE
or dropped with DROP ROLE
or DROP USER
.
To prevent sessions from being made system sessions by default, a role that has the SYSTEM_USER
privilege cannot be listed in the value of the mandatory_roles
system variable:
If 如果在启动时为mandatory_roles
is assigned a role at startup that has the SYSTEM_USER
privilege, the server writes a message to the error log and exits.mandatory_roles
分配了一个具有SYSTEM_USER
权限的角色,则服务器会在错误日志中写入一条消息并退出。
If mandatory_roles
is assigned a role at runtime that has the SYSTEM_USER
privilege, an error occurs and the mandatory_roles
value remains unchanged.
Mandatory roles, like explicitly granted roles, do not take effect until activated (see Activating Roles). 强制角色,如明确授予的角色,在激活之前不会生效(请参阅激活角色)。At login time, role activation occurs for all granted roles if the activate_all_roles_on_login
system variable is enabled; otherwise, or for roles that are set as default roles otherwise. At runtime, SET ROLE
activates roles.
Roles that do not exist when assigned to mandatory_roles
but are created later may require special treatment to be considered mandatory. For details, see Defining Mandatory Roles.
SHOW GRANTS
displays mandatory roles according to the rules described in Section 13.7.7.21, “SHOW GRANTS Statement”.SHOW GRANTS
根据第13.7.7.21节,“SHOW GRATS语句”中描述的规则显示强制角色。
--max-allowed-packet=# |
|
max_allowed_packet |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 67108864 |
Minimum Value | 1024 |
Maximum Value | 1073741824 |
Block Size | 1024 |
The maximum size of one packet or any generated/intermediate string, or any parameter sent by the 一个数据包或任何生成/中间字符串的最大大小,或mysql_stmt_send_long_data()
C API function. The default is 64MB.mysql_stmt_send_long_data()
C API函数发送的任何参数。默认值为64MB。
The packet message buffer is initialized to net_buffer_length
bytes, but can grow up to max_allowed_packet
bytes when needed. This value by default is small, to catch large (possibly incorrect) packets.默认情况下,此值较小,用于捕获较大(可能不正确)的数据包。
You must increase this value if you are using large BLOB
columns or long strings. It should be as big as the largest BLOB
you want to use. The protocol limit for max_allowed_packet
is 1GB. max_allowed_packet
的协议限制为1GB。The value should be a multiple of 1024; nonmultiples are rounded down to the nearest multiple.该值应该是1024的倍数;非倍数被四舍五入到最接近的倍数。
When you change the message buffer size by changing the value of the max_allowed_packet
variable, you should also change the buffer size on the client side if your client program permits it. The default max_allowed_packet
value built in to the client library is 1GB, but individual client programs might override this. For example, mysql and mysqldump have defaults of 16MB and 24MB, respectively. They also enable you to change the client-side value by setting 它们还允许您通过在命令行或选项文件中设置max_allowed_packet
on the command line or in an option file.max_allowed_packet
来更改客户端值。
The session value of this variable is read only. The client can receive up to as many bytes as the session value. 此变量的会话值是只读的。客户端最多可以接收与会话值一样多的字节。However, the server does not send to the client more bytes than the current global max_allowed_packet
value. (The global value could be less than the session value if the global value is changed after the client connects.)(如果在客户端连接后更改了全局值,则全局值可能小于会话值。)
--max-connect-errors=# |
|
max_connect_errors |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 100 |
Minimum Value | 1 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
After 在max_connect_errors
successive connection requests from a host are interrupted without a successful connection, the server blocks that host from further connections. max_connect_errors
之后,来自主机的连续连接请求在没有成功连接的情况下被中断,服务器会阻止该主机进行进一步的连接。If a connection from a host is established successfully within fewer than 如果在前一个连接中断后,在少于max_connect_errors
attempts after a previous connection was interrupted, the error count for the host is cleared to zero. max_connect_errors
尝试的时间内成功建立了与主机的连接,则主机的错误计数将清除为零。To unblock blocked hosts, flush the host cache; see Flushing the Host Cache.要解除阻止被阻止的主机,请刷新主机缓存;请参阅刷新主机缓存。
--max-connections=# |
|
max_connections |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 151 |
Minimum Value | 1 |
Maximum Value | 100000 |
The maximum permitted number of simultaneous client connections. 同时允许的最大客户端连接数。For more information, see Section 5.1.12.1, “Connection Interfaces”.有关更多信息,请参阅第5.1.12.1节,“连接接口”。
--max-delayed-threads=# |
|
Deprecated | Yes |
max_delayed_threads |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 20 |
Minimum Value | 0 |
Maximum Value | 16384 |
This system variable is deprecated (because 不赞成使用此系统变量(因为不支持DELAYED
inserts are not supported); expect it to be removed in a future release.DELAYED
插入);预计它将在未来的版本中删除。
--max-digest-length=# |
|
max_digest_length |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1024 |
Minimum Value | 0 |
Maximum Value | 1048576 |
The maximum number of bytes of memory reserved per session for computation of normalized statement digests. Once that amount of space is used during digest computation, truncation occurs: no further tokens from a parsed statement are collected or figure into its digest value. 每个会话为计算规范化语句摘要而保留的最大内存字节数。一旦在摘要计算过程中使用了该空间量,就会发生截断:解析语句中没有进一步的令牌被收集或计入其摘要值。Statements that differ only after that many bytes of parsed tokens produce the same normalized statement digest and are considered identical if compared or if aggregated for digest statistics.只有在许多字节的解析令牌之后才不同的语句才会产生相同的规范化语句摘要,并且如果进行比较或聚合以获得摘要统计信息,则这些语句被认为是相同的。
Setting 将max_digest_length
to zero disables digest production, which also disables server functionality that requires digests, such as MySQL Enterprise Firewall.max_dgest_length
设置为零将禁用摘要生产,这也将禁用需要摘要的服务器功能,如MySQL企业防火墙。
Decreasing the 减小max_digest_length
value reduces memory use but causes the digest value of more statements to become indistinguishable if they differ only at the end. max_digist_length
值可以减少内存使用,但如果更多语句的摘要值仅在末尾不同,则会导致它们变得不可区分。Increasing the value permits longer statements to be distinguished but increases memory use, particularly for workloads that involve large numbers of simultaneous sessions (the server allocates 增加该值可以区分较长的语句,但会增加内存使用量,尤其是对于涉及大量同时会话的工作负载(服务器为每个会话分配max_digest_length
bytes per session).max_digest_length
字节)。
The parser uses this system variable as a limit on the maximum length of normalized statement digests that it computes. 解析器使用这个系统变量来限制它计算的规范化语句摘要的最大长度。The Performance Schema, if it tracks statement digests, makes a copy of the digest value, using the 如果性能模式跟踪语句摘要,则会使用performance_schema_max_digest_length
. performance_Schema_max_digest_length
复制摘要值。system variable as a limit on the maximum length of digests that it stores. 系统变量,作为对其存储的摘要的最大长度的限制。Consequently, if 因此,如果performance_schema_max_digest_length
is less than max_digest_length
, digest values stored in the Performance Schema are truncated relative to the original digest values.performance_schema_max_dgest_length
小于max_dgesT_length
,则存储在性能模式中的摘要值相对于原始摘要值被截断。
For more information about statement digesting, see Section 27.10, “Performance Schema Statement Digests and Sampling”.有关语句消化的更多信息,请参阅第27.10节,“性能模式语句挖掘和采样”。
--max-error-count=# |
|
max_error_count |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 1024 |
Minimum Value | 0 |
Maximum Value | 65535 |
The maximum number of error, warning, and information messages to be stored for display by the SHOW ERRORS
and SHOW WARNINGS
statements. SHOW ERRORS
和SHOW WARNINGS
语句要存储以供显示的错误、警告和信息消息的最大数量。This is the same as the number of condition areas in the diagnostics area, and thus the number of conditions that can be inspected by 这与诊断区域中的状况区域数量相同,因此也与GET DIAGNOSTICS
.GET DIAGNOSTICS
可以检查的状况数量相同。
--max-execution-time=# |
|
max_execution_time |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 0 |
The execution timeout for SELECT
statements, in milliseconds. If the value is 0, timeouts are not enabled.SELECT
语句的执行超时,以毫秒为单位。如果该值为0,则不会启用超时。
max_execution_time
applies as follows:max_execution_time
应用如下:
The global 全局max_execution_time
value provides the default for the session value for new connections. max_execution_time
值为新连接的会话值提供默认值。The session value applies to SELECT
executions executed within the session that include no MAX_EXECUTION_TIME(
optimizer hint or for which N
)N
is 0.
max_execution_time
applies to read-only SELECT
statements. max_execution_time
应用于只读SELECT
语句。Statements that are not read only are those that invoke a stored function that modifies data as a side effect.非只读语句是指那些调用存储函数的语句,该函数将修改数据作为副作用。
对于存储程序中的max_execution_time
is ignored for SELECT
statements in stored programs.SELECT
语句,将忽略max_execution_time
。
--max-heap-table-size=# |
|
max_heap_table_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 16777216 |
Minimum Value | 16384 |
Maximum Value (64-bit platforms) | 18446744073709547520 |
Maximum Value (32-bit platforms) | 4294967295 |
Block Size | 1024 |
This variable sets the maximum size to which user-created 此变量设置允许用户创建的MEMORY
tables are permitted to grow. The value of the variable is used to calculate MEMORY
table MAX_ROWS
values. MEMORY
表增长的最大大小。变量的值用于计算MEMORY
表MAX_ROWS
值。Setting this variable has no effect on any existing MEMORY
table, unless the table is re-created with a statement such as CREATE TABLE
or altered with ALTER TABLE
or TRUNCATE TABLE
. A server restart also sets the maximum size of existing MEMORY
tables to the global max_heap_table_size
value.
This variable is also used in conjunction with tmp_table_size
to limit the size of internal in-memory tables. See Section 8.4.4, “Internal Temporary Table Use in MySQL”.
max_heap_table_size
is not replicated. See Section 17.5.1.21, “Replication and MEMORY Tables”, and Section 17.5.1.39, “Replication and Variables”, for more information.
Deprecated | Yes |
---|---|
max_insert_delayed_threads |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
This variable is a synonym for 此变量是max_delayed_threads
.max_delayerd_threads
的同义词。
This system variable is deprecated (because 不赞成使用此系统变量(因为不支持DELAYED
inserts are not supported); expect it to be removed in a future release.DELAYED
插入);预计它将在未来的版本中删除。
--max-join-size=# |
|
max_join_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 18446744073709551615 |
Minimum Value | 1 |
Maximum Value | 18446744073709551615 |
Do not permit statements that probably need to examine more than max_join_size
rows (for single-table statements) or row combinations (for multiple-table statements) or that are likely to do more than max_join_size
disk seeks. By setting this value, you can catch statements where keys are not used properly and that would probably take a long time. 通过设置此值,您可以捕获键使用不正确的语句,这可能需要很长时间。Set it if your users tend to perform joins that lack a 如果用户倾向于执行缺少WHERE
clause, that take a long time, or that return millions of rows. WHERE
子句、耗时较长或返回数百万行的联接,请设置它。For more information, see Using Safe-Updates Mode (--safe-updates).有关详细信息,请参阅使用安全更新模式(--safe-updates
)。
Setting this variable to a value other than 将此变量设置为DEFAULT
resets the value of sql_big_selects
to 0
. DEFAULT
以外的值会将sql_big_selects
的值重置为0
。If you set the 如果再次设置sql_big_selects
value again, the max_join_size
variable is ignored.sql_big_selects
值,则会忽略max_join_size
变量。
--max-length-for-sort-data=# |
|
Deprecated | 8.0.20 |
max_length_for_sort_data |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 4096 |
Minimum Value | 4 |
Maximum Value | 8388608 |
This variable is deprecated as of MySQL 8.0.20 due to optimizer changes that make it obsolete and of no effect. 从MySQL 8.0.20开始,该变量已被弃用,因为优化器的更改使其过时且无效。Previously, it acted as the cutoff on the size of index values that determines which 以前,它充当索引值大小的截止值,用于确定要使用的filesort
algorithm to use. filesort
算法。See Section 8.2.1.16, “ORDER BY Optimization”.请参阅第8.2.1.16节,“按优化排序”。
--max-points-in-geometry=# |
|
max_points_in_geometry |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 65536 |
Minimum Value | 3 |
Maximum Value | 1048576 |
The maximum value of the points_per_circle
argument to the ST_Buffer_Strategy()
function.
--max-prepared-stmt-count=# |
|
max_prepared_stmt_count |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 16382 |
Minimum Value | 0 |
Maximum Value (≥ 8.0.18) | 4194304 |
Maximum Value (≤ 8.0.17) | 1048576 |
This variable limits the total number of prepared statements in the server. It can be used in environments where there is the potential for denial-of-service attacks based on running the server out of memory by preparing huge numbers of statements. 此变量限一致性务器中准备语句的总数。它可以用于有可能因准备大量语句导致服务器内存不足而遭到拒绝服务攻击的环境。If the value is set lower than the current number of prepared statements, existing statements are not affected and can be used, but no new statements can be prepared until the current number drops below the limit. Setting the value to 0 disables prepared statements.如果该值设置为低于当前已准备语句的数量,则现有语句不受影响,可以使用,但在当前数量降至限制以下之前,不能准备新语句。将该值设置为0将禁用准备好的语句。
--max-seeks-for-key=# |
|
max_seeks_for_key |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value (Windows) | 4294967295 |
Default Value (Other, 64-bit platforms) | 18446744073709551615 |
Default Value (Other, 32-bit platforms) | 4294967295 |
Minimum Value | 1 |
Maximum Value (Windows) | 4294967295 |
Maximum Value (Other, 64-bit platforms) | 18446744073709551615 |
Maximum Value (Other, 32-bit platforms) | 4294967295 |
Limit the assumed maximum number of seeks when looking up rows based on a key. The MySQL optimizer assumes that no more than this number of key seeks are required when searching for matching rows in a table by scanning an index, regardless of the actual cardinality of the index (see Section 13.7.7.22, “SHOW INDEX Statement”). 根据关键字查找行时,限制假定的最大寻道次数。MySQL优化器假设,无论索引的实际基数如何,当通过扫描索引来搜索表中的匹配行时,所需的关键字搜索次数不超过此数量(请参阅第13.7.7.22节,“SHOW index语句”)。By setting this to a low value (say, 100), you can force MySQL to prefer indexes instead of table scans.通过将其设置为较低的值(例如100),可以强制MySQL更喜欢索引而不是表扫描。
--max-sort-length=# |
|
max_sort_length |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 1024 |
Minimum Value | 4 |
Maximum Value | 8388608 |
The number of bytes to use when sorting data values. 对数据值进行排序时要使用的字节数。The server uses only the first 服务器只使用每个值的第一个max_sort_length
bytes of each value and ignores the rest. max_sort_length
字节,而忽略其余字节。Consequently, values that differ only after the first 因此,对于max_sort_length
bytes compare as equal for GROUP BY
, ORDER BY
, and DISTINCT
operations.GROUP BY
、ORDER BY
和DISTINCT
操作,仅在第一个max_sort_length
字节之后不同的值比较为相等。
Increasing the value of 增加max_sort_length
may require increasing the value of sort_buffer_size
as well. max_sort_length
的值可能也需要增加sort_buffer_size
的值。For details, see Section 8.2.1.16, “ORDER BY Optimization”有关详细信息,请参阅第8.2.1.16节,“按优化排序”。
--max-sp-recursion-depth[=#] |
|
max_sp_recursion_depth |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Maximum Value | 255 |
The number of times that any given stored procedure may be called recursively. The default value for this option is 0, which completely disables recursion in stored procedures. The maximum value is 255.可以递归调用任何给定存储过程的次数。此选项的默认值为0,这将完全禁用存储过程中的递归。最大值为255。
Stored procedure recursion increases the demand on thread stack space. 存储过程递归增加了对线程堆栈空间的需求。If you increase the value of max_sp_recursion_depth
, it may be necessary to increase thread stack size by increasing the value of thread_stack
at server startup.
--max-user-connections=# |
|
max_user_connections |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 4294967295 |
The maximum number of simultaneous connections permitted to any given MySQL user account. 任何给定MySQL用户帐户允许的最大同时连接数。A value of 0 (the default) means “no limit.”值0(默认值)表示“无限制”。
This variable has a global value that can be set at server startup or runtime. It also has a read-only session value that indicates the effective simultaneous-connection limit that applies to the account associated with the current session. The session value is initialized as follows:此变量具有全局值,该值可以在服务器启动或运行时设置。它还有一个只读会话值,指示适用于与当前会话关联的帐户的有效同时连接限制。会话值初始化如下:
If the user account has a nonzero 如果用户帐户的MAX_USER_CONNECTIONS
resource limit, the session max_user_connections
value is set to that limit.MAX_user_CONNECTIONS
资源限制为非零,则会话max_user_connections
值将设置为该限制。
Otherwise, the session 否则,会话max_user_connections
value is set to the global value.max_user_connections
值将设置为全局值。
Account resource limits are specified using the 帐户资源限制是使用CREATE USER
or ALTER USER
statement. CREATE USER
或ALTER USER
语句指定的。See Section 6.2.20, “Setting Account Resource Limits”.请参阅第6.2.20节,“设置帐户资源限制”。
--max-write-lock-count=# |
|
max_write_lock_count |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value (Windows) | 4294967295 |
Default Value (Other, 64-bit platforms) | 18446744073709551615 |
Default Value (Other, 32-bit platforms) | 4294967295 |
Minimum Value | 1 |
Maximum Value (Windows) | 4294967295 |
Maximum Value (Other, 64-bit platforms) | 18446744073709551615 |
Maximum Value (Other, 32-bit platforms) | 4294967295 |
After this many write locks, permit some pending read lock requests to be processed in between. Write lock requests have higher priority than read lock requests. 在这么多写锁之后,允许在其间处理一些挂起的读锁请求。写入锁定请求的优先级高于读取锁定请求。However, if max_write_lock_count
is set to some low value (say, 10), read lock requests may be preferred over pending write lock requests if the read lock requests have already been passed over in favor of 10 write lock requests. Normally this behavior does not occur because max_write_lock_count
by default has a very large value.
--mecab-rc-file=file_name |
|
mecab_rc_file |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
The mecab_rc_file
option is used when setting up the MeCab full-text parser.mecab_rc_file
选项用于设置mecab全文分析器。
The mecab_rc_file
option defines the path to the mecabrc
configuration file, which is the configuration file for MeCab. The option is read-only and can only be set at startup. The mecabrc
configuration file is required to initialize MeCab.
For information about the MeCab full-text parser, see Section 12.10.9, “MeCab Full-Text Parser Plugin”.
For information about options that can be specified in the MeCab mecabrc
configuration file, refer to the MeCab Documentation on the Google Developers site.
--metadata-locks-cache-size=# |
|
Deprecated | Yes (removed in 8.0.13) |
metadata_locks_cache_size |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1024 |
Minimum Value | 1 |
Maximum Value | 1048576 |
This system variable was removed in MySQL 8.0.13.此系统变量已在MySQL 8.0.13中删除。
--metadata-locks-hash-instances=# |
|
Deprecated | Yes (removed in 8.0.13) |
metadata_locks_hash_instances |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8 |
Minimum Value | 1 |
Maximum Value | 1024 |
This system variable was removed in MySQL 8.0.13.此系统变量已在MySQL 8.0.13中删除。
--min-examined-row-limit=# |
|
min_examined_row_limit |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
Queries that examine fewer than this number of rows are not logged to the slow query log.检查少于此行数的查询不会记录到慢速查询日志中。
--myisam-data-pointer-size=# |
|
myisam_data_pointer_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 6 |
Minimum Value | 2 |
Maximum Value | 7 |
The default pointer size in bytes, to be used by CREATE TABLE
for MyISAM
tables when no MAX_ROWS
option is specified. This variable cannot be less than 2 or larger than 7. The default value is 6. See Section B.3.2.10, “The table is full”.
--myisam-max-sort-file-size=# |
|
myisam_max_sort_file_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value (Windows) | 2146435072 |
Default Value (Other, 64-bit platforms) | 9223372036853727232 |
Default Value (Other, 32-bit platforms) | 2147483648 |
Maximum Value (Windows) | 2146435072 |
Maximum Value (Other, 64-bit platforms) | 9223372036853727232 |
Maximum Value (Other, 32-bit platforms) | 2147483648 |
The maximum size of the temporary file that MySQL is permitted to use while re-creating a MyISAM
index (during REPAIR TABLE
, ALTER TABLE
, or LOAD DATA
). If the file size would be larger than this value, the index is created using the key cache instead, which is slower. The value is given in bytes.
If 如果MyISAM
index files exceed this size and disk space is available, increasing the value may help performance. MyISAM
索引文件超过此大小并且磁盘空间可用,则增加该值可能有助于提高性能。The space must be available in the file system containing the directory where the original index file is located.该空间必须在包含原始索引文件所在目录的文件系统中可用。
--myisam-mmap-size=# |
|
myisam_mmap_size |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value (64-bit platforms) | 18446744073709551615 |
Default Value (32-bit platforms) | 4294967295 |
Minimum Value | 7 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
The maximum amount of memory to use for memory mapping compressed MyISAM
files. If many compressed MyISAM
tables are used, the value can be decreased to reduce the likelihood of memory-swapping problems.
--myisam-recover-options[=list] |
|
myisam_recover_options |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | OFF |
Valid Values |
|
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 | |
BACKUP | If the data file was changed during recovery, save a backup of the file as . |
FORCE | Run recovery even if we would lose more than one row from the .MYD file. |
QUICK |
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
. 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 16.2.1, “MyISAM Startup Options”.请参阅第16.2.1节,“MyISAM启动选项”。
--myisam-repair-threads=# |
|
myisam_repair_threads |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1 |
Minimum Value | 1 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
If this value is greater than 1, 如果此值大于1,则在MyISAM
table indexes are created in parallel (each index in its own thread) during the Repair by sorting
process. The default value is 1.Repair by sorting
过程中,将并行创建MyISAM
表索引(每个索引在其自己的线程中)。默认值为1。
Multithreaded repair is still beta-quality code.
--myisam-sort-buffer-size=# |
|
myisam_sort_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8388608 |
Minimum Value | 4096 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
The size of the buffer that is allocated when sorting MyISAM
indexes during a REPAIR TABLE
or when creating indexes with CREATE INDEX
or ALTER TABLE
.
--myisam-stats-method=name |
|
myisam_stats_method |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | nulls_unequal |
Valid Values |
|
How the server treats NULL
values when collecting statistics about the distribution of index values for MyISAM
tables. This variable has three possible values, nulls_equal
, nulls_unequal
, and nulls_ignored
. For nulls_equal
, all NULL
index values are considered equal and form a single value group that has a size equal to the number of NULL
values. For nulls_unequal
, NULL
values are considered unequal, and each NULL
forms a distinct value group of size 1. For nulls_ignored
, NULL
values are ignored.
The method that is used for generating table statistics influences how the optimizer chooses indexes for query execution, as described in Section 8.3.8, “InnoDB and MyISAM Index Statistics Collection”.
--myisam-use-mmap[={OFF|ON}] |
|
myisam_use_mmap |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Use memory mapping for reading and writing 使用内存映射读取和写入MyISAM
tables.MyISAM
表。
mysql_native_password_proxy_users
--mysql-native-password-proxy-users[={OFF|ON}] |
|
mysql_native_password_proxy_users |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable controls whether the mysql_native_password
built-in authentication plugin supports proxy users. It has no effect unless the check_proxy_users
system variable is enabled. For information about user proxying, see Section 6.2.18, “Proxy Users”.
--named-pipe[={OFF|ON}] |
|
named_pipe |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Platform Specific | Windows |
Type | Boolean |
Default Value | OFF |
(Windows only.) Indicates whether the server supports connections over named pipes.(仅限Windows。)指示服务器是否支持通过命名管道进行连接。
--named-pipe-full-access-group=value |
|
Introduced | 8.0.14 |
named_pipe_full_access_group |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Platform Specific | Windows |
Type | String |
Default Value | empty string |
Valid Values |
|
(Windows only.) The access control granted to clients on the named pipe created by the MySQL server is set to the minimum necessary for successful communication when the (仅限Windows。)当named_pipe
system variable is enabled to support named-pipe connections. named_pipe
系统变量被启用以支持命名管道连接时,在MySQL服务器创建的命名管道上授予客户端的访问控制被设置为成功通信所需的最小值。Newer MySQL client software can open named pipe connections without any additional configuration; however, older client software may still require full access to open a named pipe connection.较新的MySQL客户端软件可以打开命名管道连接,无需任何额外配置;但是,较旧的客户端软件可能仍然需要完全访问才能打开命名管道连接。
This variable sets the name of a Windows local group whose members are granted sufficient access by the MySQL server to use older named-pipe clients. 此变量设置Windows本地组的名称,MySQL服务器授予其成员足够的访问权限以使用较旧的命名管道客户端。As of MySQL 8.0.24, the default value is set to an empty string, which means that no Windows user is granted full access to the named pipe.从MySQL 8.0.24开始,默认值设置为空字符串,这意味着没有Windows用户被授予对命名管道的完全访问权限。
A new Windows local group name (for example, 可以在Windows中创建一个新的Windows本地组名称(例如,mysql_old_client_users
) can be created in Windows and then used to replace the default value when access is absolutely necessary. mysql_old_client_users
),然后在绝对需要访问时用于替换默认值。In this case, limit the membership of the group to as few users as possible, removing users from the group when their client software is upgraded. 在这种情况下,请将组的成员资格限制为尽可能少的用户,以便在升级用户的客户端软件时将其从组中删除。A non-member of the group who attempts to open a connection to MySQL with the older named-pipe client is denied access until a Windows administrator adds the user to the group. Newly added users must log out and log in again to join the group (required by Windows).在Windows管理员将用户添加到组之前,尝试使用旧的命名管道客户端打开MySQL连接的非组成员将被拒绝访问。新添加的用户必须注销并重新登录才能加入组(Windows要求)。
Setting the value to 将值设置为'*everyone*'
provides a language-independent way of referring to the Everyone group on Windows. The Everyone group is not secure by default.'*everyone*'
提供了一种独立于语言的方式来引用Windows上的everyone组。默认情况下,Everyone组不安全。
--net-buffer-length=# |
|
net_buffer_length |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 16384 |
Minimum Value | 1024 |
Maximum Value | 1048576 |
Block Size | 1024 |
Each client thread is associated with a connection buffer and result buffer. 每个客户端线程都与一个连接缓冲区和结果缓冲区相关联。Both begin with a size given by net_buffer_length
but are dynamically enlarged up to max_allowed_packet
bytes as needed. The result buffer shrinks to net_buffer_length
after each SQL statement.
This variable should not normally be changed, but if you have very little memory, you can set it to the expected length of statements sent by clients. 该变量通常不应更改,但如果内存非常少,则可以将其设置为客户端发送的语句的预期长度。If statements exceed this length, the connection buffer is automatically enlarged. 如果语句超过此长度,连接缓冲区将自动扩大。The maximum value to which 可以设置net_buffer_length
can be set is 1MB.net_buffer_length
的最大值为1MB。
The session value of this variable is read only.
--net-read-timeout=# |
|
net_read_timeout |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 30 |
Minimum Value | 1 |
The number of seconds to wait for more data from a connection before aborting the read. 在中止读取之前等待来自连接的更多数据的秒数。When the server is reading from the client, net_read_timeout
is the timeout value controlling when to abort. When the server is writing to the client, net_write_timeout
is the timeout value controlling when to abort. See also slave_net_timeout
.
--net-retry-count=# |
|
net_retry_count |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 10 |
Minimum Value | 1 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
If a read or write on a communication port is interrupted, retry this many times before giving up. This value should be set quite high on FreeBSD because internal interrupts are sent to all threads.如果通信端口上的读取或写入被中断,请在放弃之前重试多次。这个值应该在FreeBSD上设置得很高,因为内部中断被发送到所有线程。
--net-write-timeout=# |
|
net_write_timeout |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 60 |
Minimum Value | 1 |
The number of seconds to wait for a block to be written to a connection before aborting the write. See also 在中止写入之前等待将块写入连接的秒数。另请参阅net_read_timeout
.net_read_timeout
。
--new[={OFF|ON}] |
|
new |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Disabled by | skip-new |
Type | Boolean |
Default Value | OFF |
This variable was used in MySQL 4.0 to turn on some 4.1 behaviors, and is retained for backward compatibility. Its value is always 此变量在MySQL 4.0中用于启用某些4.1行为,并保留用于向后兼容性。其值始终为OFF
.OFF
。
In NDB Cluster, setting this variable to ON
makes it possible to employ partitioning types other than KEY
or LINEAR KEY
with NDB
tables. This feature is experimental only, and not supported in production. For additional information, see User-defined partitioning and the NDB storage engine (NDB Cluster).有关其他信息,请参阅用户定义的分区和NDB存储引擎(NDB集群)。
--ngram-token-size=# |
|
ngram_token_size |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 2 |
Minimum Value | 1 |
Maximum Value | 10 |
Defines the n-gram token size for the n-gram full-text parser. 定义n-gram全文分析器的n-gram标记大小。The ngram_token_size
option is read-only and can only be modified at startup. The default value is 2 (bigram). The maximum value is 10.ngram_token_size
选项是只读的,只能在启动时修改。默认值为2(bigram)。最大值为10。
For more information about how to configure this variable, see Section 12.10.8, “ngram Full-Text Parser”.有关如何配置此变量的更多信息,请参阅第12.10.8节,“ngram全文分析器”。
--offline-mode[={OFF|ON}] |
|
offline_mode |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether the server is in “offline mode”, which has these characteristics:服务器是否处于“脱机模式”,具有以下特征:
Connected client users who do not have the CONNECTION_ADMIN
privilege (or the deprecated SUPER
privilege) are disconnected on the next request, with an appropriate error. Disconnection includes terminating running statements and releasing locks. Such clients also cannot initiate new connections, and receive an appropriate error.这样的客户端也不能发起新的连接,并且不能接收适当的错误。
Connected client users who have the 具有CONNECTION_ADMIN
or SUPER
privilege are not disconnected, and can initiate new connections to manage the server.CONNECTION_ADMIN
或SUPER
权限的已连接客户端用户不会断开连接,并且可以启动新的连接来管理服务器。
Replication threads are permitted to keep applying data to the server.允许复制线程继续将数据应用到服务器。
Only users who have the 只有具有SYSTEM_VARIABLES_ADMIN
or SUPER
privilege can control offline mode. SYSTEM_VARIABLES_ADMIN
或SUPER
权限的用户才能控制脱机模式。To put a server in offline mode, change the value of the 要使服务器处于脱机模式,请将offline_mode
system variable from OFF
to ON
. offline_mode
系统变量的值从OFF
更改为ON
。To resume normal operations, change offline_mode
from ON
to OFF
. In offline mode, clients that are refused access receive an ER_SERVER_OFFLINE_MODE
error.
--old[={OFF|ON}] |
|
old |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
old
is a compatibility variable. It is disabled by default, but can be enabled at startup to revert the server to behaviors present in older versions.old
是一个兼容性变量。它在默认情况下是禁用的,但可以在启动时启用,以将服务器恢复到旧版本中的行为。
When 当启用old
is enabled, it changes the default scope of index hints to that used prior to MySQL 5.1.17. old
时,它会将索引提示的默认范围更改为MySQL 5.1.17之前使用的范围。That is, index hints with no 也就是说,不带FOR
clause apply only to how indexes are used for row retrieval and not to resolution of ORDER BY
or GROUP BY
clauses. FOR
子句的索引提示仅适用于如何使用索引进行行检索,而不适用于ORDER BY
或GROUP BY
子句的解析。(See Section 8.9.4, “Index Hints”.) (参见第8.9.4节,“索引提示”。)Take care about enabling this in a replication setup. With statement-based binary logging, having different modes for the source and replicas might lead to replication errors.请注意在复制设置中启用此功能。对于基于语句的二进制日志记录,对源和副本使用不同的模式可能会导致复制错误。
--old-alter-table[={OFF|ON}] |
|
old_alter_table |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
When this variable is enabled, the server does not use the optimized method of processing an 启用此变量时,服务器不使用优化的方法来处理ALTER TABLE
operation. ALTER TABLE
操作。It reverts to using a temporary table, copying over the data, and then renaming the temporary table to the original, as used by MySQL 5.0 and earlier. 它恢复为使用临时表,复制数据,然后将临时表重命名为MySQL 5.0及更早版本使用的原始表。For more information on the operation of 有关ALTER TABLE
, see Section 13.1.9, “ALTER TABLE Statement”.ALTER TABLE
操作的更多信息,请参阅第13.1.9节,“ALTER TABLE语句”。
ALTER TABLE ... DROP PARTITION
with old_alter_table=ON
rebuilds the partitioned table and attempts to move data from the dropped partition to another partition with a compatible PARTITION ... VALUES
definition. Data that cannot be moved to another partition is deleted. In earlier releases, ALTER TABLE ... DROP PARTITION
with old_alter_table=ON
deletes data stored in the partition and drops the partition.
--open-files-limit=# |
|
open_files_limit |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value |
|
Minimum Value | 0 |
Maximum Value | platform dependent |
The number of file descriptors available to mysqld from the operating system:操作系统中可用于mysqld的文件描述符数:
At startup, mysqld reserves descriptors with setrlimit()
, using the value requested at by setting this variable directly or by using the --open-files-limit
option to mysqld_safe. If mysqld produces the error Too many open files
, try increasing the open_files_limit
value. Internally, the maximum value for this variable is the maximum unsigned integer value, but the actual maximum is platform dependent.在内部,此变量的最大值是最大无符号整数值,但实际最大值取决于平台。
At runtime, the value of 在运行时,open_files_limit
indicates the number of file descriptors actually permitted to mysqld by the operating system, which might differ from the value requested at startup. If the number of file descriptors requested during startup cannot be allocated, mysqld writes a warning to the error log.open_files_limit
的值表示操作系统实际允许mysqld使用的文件描述符的数量,这可能与启动时请求的值不同。如果启动期间请求的文件描述符数量无法分配,mysqld会在错误日志中写入警告。
The effective open_files_limit
value is based on the value specified at system startup (if any) and the values of max_connections
and table_open_cache
, using these formulas:
10 + max_connections + (table_open_cache * 2)
max_connections * 5
MySQL 8.0.19 and higher: The operating system limit.MySQL 8.0.19及更高版本:操作系统限制。
Prior to MySQL 8.0.19:MySQL 8.0.19之前:
The operating system limit if that limit is positive but not Infinity.操作系统限制,如果该限制为正,但不是无穷大。
If the operating system limit is Infinity: 如果操作系统限制为无穷大:如果在启动时指定了open_files_limit
value if specified at startup, 5000 if not.open_files_limit
值,则为5000。
The server attempts to obtain the number of file descriptors using the maximum of those values, capped to the maximum unsigned integer value. 服务器尝试使用这些值中的最大值来获取文件描述符的数量,上限为最大无符号整数值。If that many descriptors cannot be obtained, the server attempts to obtain as many as the system permits.如果不能获得那么多描述符,则服务器尝试获得系统允许的尽可能多的描述符。
The effective value is 0 on systems where MySQL cannot change the number of open files.在MySQL无法更改打开文件数的系统上,有效值为0。
On Unix, the value cannot be set greater than the value displayed by the ulimit -n command.在Unix上,该值不能设置为大于ulimit -n命令显示的值。
--optimizer-prune-level=# |
|
optimizer_prune_level |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 1 |
Minimum Value | 0 |
Maximum Value | 1 |
Controls the heuristics applied during query optimization to prune less-promising partial plans from the optimizer search space. 控制在查询优化期间应用的试探法,以从优化器搜索空间中删除不太有希望的部分计划。A value of 0 disables heuristics so that the optimizer performs an exhaustive search. A value of 1 causes the optimizer to prune plans based on the number of rows retrieved by intermediate plans.值为0将禁用启发式,以便优化器执行彻底搜索。值为1时,优化器会根据中间计划检索到的行数来修剪计划。
--optimizer-search-depth=# |
|
optimizer_search_depth |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 62 |
Minimum Value | 0 |
Maximum Value | 62 |
The maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to generate an execution plan for a query. 查询优化器执行的最大搜索深度。大于查询中关系数的值会产生更好的查询计划,但生成查询的执行计划需要更长的时间。Values smaller than the number of relations in a query return an execution plan quicker, but the resulting plan may be far from being optimal. If set to 0, the system automatically picks a reasonable value.小于查询中关系数的值可以更快地返回执行计划,但生成的计划可能远不是最佳的。如果设置为0,系统会自动选择一个合理的值。
--optimizer-switch=value |
|
optimizer_switch |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Set |
Valid Values (≥ 8.0.22) |
|
Valid Values (≥ 8.0.21) |
|
Valid Values (≥ 8.0.18) |
|
Valid Values (≥ 8.0.13) |
|
Valid Values (≤ 8.0.12) |
|
The optimizer_switch
system variable enables control over optimizer behavior. The value of this variable is a set of flags, each of which has a value of on
or off
to indicate whether the corresponding optimizer behavior is enabled or disabled. This variable has global and session values and can be changed at runtime. The global default can be set at server startup.此变量具有全局值和会话值,可以在运行时更改。全局默认值可以在服务器启动时设置。
To see the current set of optimizer flags, select the variable value:要查看当前的优化器标志集,请选择变量值:
mysql> SELECT @@optimizer_switch\G
*************************** 1. row ***************************
@@optimizer_switch: index_merge=on,index_merge_union=on,
index_merge_sort_union=on,index_merge_intersection=on,
engine_condition_pushdown=on,index_condition_pushdown=on,
mrr=on,mrr_cost_based=on,block_nested_loop=on,
batched_key_access=off,materialization=on,semijoin=on,
loosescan=on,firstmatch=on,duplicateweedout=on,
subquery_materialization_cost_based=on,
use_index_extensions=on,condition_fanout_filter=on,
derived_merge=on,use_invisible_indexes=off,skip_scan=on,
hash_join=on,subquery_to_derived=off,
prefer_ordering_index=on,hypergraph_optimizer=off,
derived_condition_pushdown=on
For more information about the syntax of this variable and the optimizer behaviors that it controls, see Section 8.9.2, “Switchable Optimizations”.有关此变量的语法及其控制的优化器行为的更多信息,请参阅第8.9.2节,“可切换优化”。
--optimizer-trace=value |
|
optimizer_trace |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
This variable controls optimizer tracing. 此变量控制优化器跟踪。For details, see MySQL Internals: Tracing the Optimizer.有关详细信息,请参阅MySQL内部:跟踪优化器。
--optimizer-trace-features=value |
|
optimizer_trace_features |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
This variable enables or disables selected optimizer tracing features. For details, see MySQL Internals: Tracing the Optimizer.此变量启用或禁用选定的优化器跟踪功能。有关详细信息,请参阅MySQL内部:跟踪优化器。
--optimizer-trace-limit=# |
|
optimizer_trace_limit |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1 |
The maximum number of optimizer traces to display. For details, see MySQL Internals: Tracing the Optimizer.要显示的优化器跟踪的最大数目。有关详细信息,请参阅MySQL内部:跟踪优化器。
--optimizer-trace-max-mem-size=# |
|
optimizer_trace_max_mem_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 1048576 |
The maximum cumulative size of stored optimizer traces. 存储的优化器跟踪的最大累积大小。For details, see MySQL Internals: Tracing the Optimizer.有关详细信息,请参阅MySQL内部:跟踪优化器。
--optimizer-trace-offset=# |
|
optimizer_trace_offset |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | -1 |
The offset of optimizer traces to display. For details, see MySQL Internals: Tracing the Optimizer.要显示的优化器跟踪的偏移量。有关详细信息,请参阅MySQL内部:跟踪优化器。
performance_schema_
xxx
Performance Schema system variables are listed in Section 27.15, “Performance Schema System Variables”. 第27.15节,“性能模式系统变量”列出了性能模式的系统变量。These variables may be used to configure Performance Schema operation.这些变量可用于配置性能模式操作。
--parser-max-mem-size=# |
|
parser_max_mem_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value (64-bit platforms) | 18446744073709551615 |
Default Value (32-bit platforms) | 4294967295 |
Minimum Value | 10000000 |
Maximum Value (64-bit platforms) | 18446744073709551615 |
Maximum Value (32-bit platforms) | 4294967295 |
The maximum amount of memory available to the parser. The default value places no limit on memory available. The value can be reduced to protect against out-of-memory situations caused by parsing long or complex SQL statements.解析程序可用的最大内存量。默认值不限制可用内存。可以减少该值,以防止解析长或复杂的SQL语句时出现内存不足的情况。
--partial-revokes[={OFF|ON}] |
|
Introduced | 8.0.16 |
partial_revokes |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value |
|
Enabling this variable makes it possible to revoke privileges partially. 启用此变量可以部分吊销特权。Specifically, for users who have privileges at the global level, partial_revokes
enables privileges for specific schemas to be revoked while leaving the privileges in place for other schemas. For example, a user who has the global UPDATE
privilege can be restricted from exercising this privilege on the mysql
system schema. (Or, stated another way, the user is enabled to exercise the UPDATE
privilege on all schemas except the mysql
schema.) In this sense, the user's global UPDATE
privilege is partially revoked.
Once enabled, partial_revokes
cannot be disabled if any account has privilege restrictions. If any such account exists, disabling partial_revokes
fails:
For attempts to disable partial_revokes
at startup, the server logs an error message and enables partial_revokes
.
For attempts to disable partial_revokes
at runtime, an error occurs and the partial_revokes
value remains unchanged.
To disable 要在这种情况下禁用partial_revokes
in this case, first modify each account that has partially revoked privileges, either by re-granting the privileges or by removing the account.partial_revokes
,请首先通过重新授予特权或删除帐户来修改每个已部分吊销特权的帐户。
In privilege assignments, enabling partial_revokes
causes MySQL to interpret occurrences of unescaped _
and %
SQL wildcard characters in schema names as literal characters, just as if they had been escaped as \_
and \%
. Because this changes how MySQL interprets privileges, it may be advisable to avoid unescaped wildcard characters in privilege assignments for installations where partial_revokes
may be enabled.
For more information, including instructions for removing partial revokes, see Section 6.2.12, “Privilege Restriction Using Partial Revokes”.有关更多信息,包括删除部分撤销的说明,请参阅第6.2.12节,“使用部分撤销的特权限制”。
--password-history=# |
|
password_history |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 4294967295 |
This variable defines the global policy for controlling reuse of previous passwords based on required minimum number of password changes. 此变量定义了全局策略,用于根据所需的最小密码更改次数控制以前密码的重复使用。For an account password used previously, this variable indicates the number of subsequent account password changes that must occur before the password can be reused. If the value is 0 (the default), there is no reuse restriction based on number of password changes.对于以前使用的帐户密码,此变量表示在重新使用密码之前必须进行的后续帐户密码更改次数。如果该值为0(默认值),则不存在基于密码更改次数的重用限制。
Changes to this variable apply immediately to all accounts defined with the PASSWORD HISTORY DEFAULT
option.
The global number-of-changes password reuse policy can be overridden as desired for individual accounts using the PASSWORD HISTORY
option of the CREATE USER
and ALTER USER
statements. See Section 6.2.15, “Password Management”.
--password-require-current[={OFF|ON}] |
|
Introduced | 8.0.13 |
password_require_current |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable defines the global policy for controlling whether attempts to change an account password must specify the current password to be replaced.此变量定义全局策略,用于控制更改帐户密码的尝试是否必须指定要替换的当前密码。
Changes to this variable apply immediately to all accounts defined with the 对此变量的更改将立即应用于使用PASSWORD REQUIRE CURRENT DEFAULT
option.PASSWORD REQUIRE CURRENT DEFAULT
选项定义的所有帐户。
The global verification-required policy can be overridden as desired for individual accounts using the PASSWORD REQUIRE
option of the CREATE USER
and ALTER USER
statements. See Section 6.2.15, “Password Management”.
--password-reuse-interval=# |
|
password_reuse_interval |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 4294967295 |
This variable defines the global policy for controlling reuse of previous passwords based on time elapsed. 此变量定义全局策略,用于根据经过的时间控制以前密码的重复使用。For an account password used previously, this variable indicates the number of days that must pass before the password can be reused. 对于以前使用的帐户密码,此变量指示密码必须经过的天数,然后才能重复使用。If the value is 0 (the default), there is no reuse restriction based on time elapsed.如果该值为0(默认值),则不存在基于所用时间的重用限制。
Changes to this variable apply immediately to all accounts defined with the PASSWORD REUSE INTERVAL DEFAULT
option.
The global time-elapsed password reuse policy can be overridden as desired for individual accounts using the PASSWORD REUSE INTERVAL
option of the CREATE USER
and ALTER USER
statements. See Section 6.2.15, “Password Management”.
--persisted-globals-load[={OFF|ON}] |
|
persisted_globals_load |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
Whether to load persisted configuration settings from the 是否从数据目录中的mysqld-auto.cnf
file in the data directory. mysqld-auto.conf
文件加载持久化配置设置。The server normally processes this file at startup after all other option files (see Section 4.2.2.2, “Using Option Files”). Disabling persisted_globals_load
causes the server startup sequence to skip mysqld-auto.cnf
.
To modify the contents of mysqld-auto.cnf
, use the SET PERSIST
, SET PERSIST_ONLY
, and RESET PERSIST
statements. See Section 5.1.9.3, “Persisted System Variables”.
persist_only_admin_x509_subject
--persist-only-admin-x509-subject=string |
|
Introduced | 8.0.14 |
persist_only_admin_x509_subject |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value | empty string |
SET PERSIST
and SET PERSIST_ONLY
enable system variables to be persisted to the mysqld-auto.cnf
option file in the data directory (see Section 13.7.6.1, “SET Syntax for Variable Assignment”). Persisting system variables enables runtime configuration changes that affect subsequent server restarts, which is convenient for remote administration not requiring direct access to MySQL server host option files. However, some system variables are nonpersistible or can be persisted only under certain restrictive conditions.
The persist_only_admin_x509_subject
system variable specifies the SSL certificate X.509 Subject value that users must have to be able to persist system variables that are persist-restricted. The default value is the empty string, which disables the Subject check so that persist-restricted system variables cannot be persisted by any user.
If persist_only_admin_x509_subject
is nonempty, users who connect to the server using an encrypted connection and supply an SSL certificate with the designated Subject value then can use SET PERSIST_ONLY
to persist persist-restricted system variables. For information about persist-restricted system variables and instructions for configuring MySQL to enable persist_only_admin_x509_subject
, see Section 5.1.9.4, “Nonpersistible and Persist-Restricted System Variables”.
--pid-file=file_name |
|
pid_file |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
The path name of the file in which the server writes its process ID. The server creates the file in the data directory unless an absolute path name is given to specify a different directory. 服务器写入进程ID的文件的路径名。除非指定了绝对路径名以指定其他目录,否则服务器会在数据目录中创建文件。If you specify this variable, you must specify a value. If you do not specify this variable, MySQL uses a default value of 如果指定此变量,则必须指定一个值。如果未指定此变量,MySQL将使用默认值
, where host_name
.pidhost_name
is the name of the host machine.host_name.pid
,其中host_name
是主机的名称。
The process ID file is used by other programs such as mysqld_safe to determine the server's process ID. On Windows, this variable also affects the default error log file name. See Section 5.4.2, “The Error Log”.
--plugin-dir=dir_name |
|
plugin_dir |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Directory name |
Default Value | BASEDIR/lib/plugin |
The path name of the plugin directory.插件目录的路径名。
If the plugin directory is writable by the server, it may be possible for a user to write executable code to a file in the directory using 如果插件目录可由服务器写入,则用户可以使用SELECT ... INTO DUMPFILE
. SELECT ... INTO DUMPFILE
将可执行代码写入目录中的文件。This can be prevented by making plugin_dir
read only to the server or by setting secure_file_priv
to a directory where SELECT
writes can be made safely.
--port=port_num |
|
port |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 3306 |
Minimum Value | 0 |
Maximum Value | 65535 |
The number of the port on which the server listens for TCP/IP connections. 服务器侦听TCP/IP连接的端口号。This variable can be set with the 此变量可以使用--port
option.--port
选项进行设置。
--preload-buffer-size=# |
|
preload_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 32768 |
Minimum Value | 1024 |
Maximum Value | 1073741824 |
The size of the buffer that is allocated when preloading indexes.预加载索引时分配的缓冲区的大小。
--print-identified-with-as-hex[={OFF|ON}] |
|
Introduced | 8.0.17 |
print_identified_with_as_hex |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Password hash values displayed in the IDENTIFIED WITH
clause of output from SHOW CREATE USER
may contain unprintable characters that have adverse effects on terminal displays and in other environments. Enabling print_identified_with_as_hex
causes SHOW CREATE USER
to display such hash values as hexadecimal strings rather than as regular string literals. Hash values that do not contain unprintable characters still display as regular string literals, even with this variable enabled.即使启用了此变量,不包含不可打印字符的哈希值仍显示为常规字符串文字。
If set to 0 or 如果设置为0或OFF
(the default), statement profiling is disabled. OFF
(默认值),则禁用语句分析。If set to 1 or ON
, statement profiling is enabled and the SHOW PROFILE
and SHOW PROFILES
statements provide access to profiling information. See Section 13.7.7.31, “SHOW PROFILES Statement”.
This variable is deprecated; expect it to be removed in a future MySQL release.此变量已弃用;期望它在未来的MySQL版本中被删除。
The number of statements for which to maintain profiling information if 如果启用了profiling
is enabled. The default value is 15. profiling
,则要维护其分析信息的语句数。默认值为15。The maximum value is 100. Setting the value to 0 effectively disables profiling. 最大值为100。将该值设置为0将有效地禁用分析。See Section 13.7.7.31, “SHOW PROFILES Statement”.请参阅第13.7.7.31节,“SHOW PROFILES语句”。
This variable is deprecated; expect it to be removed in a future MySQL release.此变量已弃用;期望它在未来的MySQL版本中被删除。
protocol_compression_algorithms
--protocol-compression-algorithms=value |
|
Introduced | 8.0.18 |
protocol_compression_algorithms |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Set |
Default Value | zlib,zstd,uncompressed |
Valid Values |
|
The compression algorithms that the server permits for incoming connections. 服务器允许传入连接使用的压缩算法。These include connections by client programs and by servers participating in source/replica replication or Group Replication. 其中包括客户端程序和参与源/副本复制或组复制的服务器之间的连接。Compression does not apply to connections for 压缩不适用于FEDERATED
tables.FEDERATED
表的连接。
protocol_compression_algorithms
does not control connection compression for X Protocol. protocol_compression_agorithms
不控制X协议的连接压缩。See Section 20.5.5, “Connection Compression with X Plugin” for information on how this operates.有关如何操作的信息,请参阅第20.5.5节,“使用X插件进行连接压缩”。
The variable value is a list of one or more comma-separated compression algorithm names, in any order, chosen from the following items (not case-sensitive):变量值是一个或多个逗号分隔的压缩算法名称的列表,按任何顺序从以下项目中选择(不区分大小写):
zlib
: Permit connections that use the zlib
compression algorithm.
zstd
: Permit connections that use the zstd
compression algorithm (zstd 1.3).
uncompressed
: Permit uncompressed connections. If this algorithm name is not included in the protocol_compression_algorithms
value, the server does not permit uncompressed connections. It permits only compressed connections that use whichever other algorithms are specified in the value, and there is no fallback to uncompressed connections.
The default value of zlib的默认值zlib,zstd,uncompressed
indicates that the server permits all compression algorithms.zlib,zstd,uncompressed
,表示服务器允许所有压缩算法。
For more information, see Section 4.2.8, “Connection Compression Control”.有关更多信息,请参阅第4.2.8节,“连接压缩控制”。
protocol_version |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
The version of the client/server protocol used by the MySQL server.MySQL服务器使用的客户端/服务器协议的版本。
proxy_user |
|
Session | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
If the current client is a proxy for another user, this variable is the proxy user account name. 如果当前客户端是另一个用户的代理,则此变量为代理用户帐户名。Otherwise, this variable is 否则,此变量为NULL
. See Section 6.2.18, “Proxy Users”.NULL
。参见第6.2.18节,“代理用户”。
pseudo_slave_mode |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
This system variable is for internal server use. 此系统变量供内部服务器使用。pseudo_slave_mode
assists with the correct handling of transactions that originated on older or newer servers than the server currently processing them. pseudo_slave_mode
有助于正确处理起源于比当前处理它们的服务器更旧或更新的服务器上的事务。mysqlbinlog sets the value of pseudo_slave_mode
to true before executing any SQL statements.
Setting the session value of this system variable is a restricted operation. 设置此系统变量的会话值是一项受限制的操作。The session user must have either the 会话用户必须具有REPLICATION_APPLIER
privilege (see Section 17.3.3, “Replication Privilege Checks”), or privileges sufficient to set restricted session variables (see Section 5.1.9.1, “System Variable Privileges”). REPLICATION_APPLIER
权限(请参阅第17.3.3节,“复制权限检查”)或足以设置受限会话变量的权限(请参见第5.1.9.1节,“系统变量权限”)。However, note that the variable is not intended for users to set; it is set automatically by the replication infrastructure.但是,请注意,该变量不是供用户设置的;它是由复制基础结构自动设置的。
pseudo_slave_mode
has the following effects on the handling of prepared XA transactions, which can be attached to or detached from the handling session (by default, the session that issues XA START
):
If true, and the handling session has executed an internal-use BINLOG
statement, XA transactions are automatically detached from the session as soon as the first part of the transaction up to XA PREPARE
finishes, so they can be committed or rolled back by any session that has the XA_RECOVER_ADMIN
privilege.
If false, XA transactions remain attached to the handling session as long as that session is alive, during which time no other session can commit the transaction. The prepared transaction is only detached if the session disconnects or the server restarts.如果为false
,则只要处理会话处于活动状态,XA事务就会一直附加到该会话,在此期间,没有其他会话可以提交事务。只有在会话断开连接或服务器重新启动时,准备好的事务才会分离。
pseudo_slave_mode
has the following effects on the original_commit_timestamp
replication delay timestamp and the original_server_version
system variable:
If true, transactions that do not explicitly set 如果为original_commit_timestamp
or original_server_version
are assumed to originate on another, unknown server, so the value 0, meaning unknown, is assigned to both the timestamp and the system variable.true
,则假定未显式设置original_commit_timestamp
或original_server_version
的事务源自另一个未知服务器,因此将值0(表示未知)分配给时间戳和系统变量。
If false, transactions that do not explicitly set original_commit_timestamp
or original_server_version
are assumed to originate on the current server, so the current timestamp and the current server's version are assigned to the timestamp and the system variable.
In MySQL 8.0.14 and later, 在MySQL 8.0.14及更高版本中,pseudo_slave_mode
has the following effects on the handling of a statement that sets one or more unsupported (removed or unknown) SQL modes:pseudo_slave_mode
对设置一个或多个不受支持(已删除或未知)SQL模式的语句的处理有以下影响:
If true, the server ignores the unsupported mode and raises a warning.如果为true
,则服务器将忽略不支持的模式并发出警告。
If false, the server rejects the statement with ER_UNSUPPORTED_SQL_MODE
.
pseudo_thread_id |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
This variable is for internal server use.此变量供内部服务器使用。
Changing the session value of the pseudo_thread_id
system variable changes the value returned by the CONNECTION_ID()
function.
As of MySQL 8.0.14, setting the session value of this system variable is a restricted operation. The session user must have privileges sufficient to set restricted session variables. See Section 5.1.9.1, “System Variable Privileges”.从MySQL 8.0.14开始,设置此系统变量的会话值是一项受限制的操作。会话用户必须具有足够的权限来设置受限制的会话变量。参见第5.1.9.1节,“系统变量权限”。
--query-alloc-block-size=# |
|
query_alloc_block_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8192 |
Minimum Value | 1024 |
Maximum Value | 4294967295 |
Unit | bytes |
Block Size | 1024 |
The allocation size in bytes of memory blocks that are allocated for objects created during statement parsing and execution. If you have problems with memory fragmentation, it might help to increase this parameter.为语句解析和执行期间创建的对象分配的内存块的分配大小(以字节为单位)。如果内存碎片有问题,增加此参数可能会有所帮助。
--query-prealloc-size=# |
|
query_prealloc_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8192 |
Minimum Value | 8192 |
Maximum Value (64-bit platforms) | 18446744073709547520 |
Maximum Value (32-bit platforms) | 4294967295 |
Block Size | 1024 |
The size in bytes of the persistent buffer used for statement parsing and execution.用于语句解析和执行的持久缓冲区的大小(以字节为单位)。This buffer is not freed between statements.在语句之间不会释放此缓冲区。If you are running complex queries, a larger 如果您正在运行复杂的查询,较大的query_prealloc_size
value might be helpful in improving performance, because it can reduce the need for the server to perform memory allocation during query execution operations.query_prealloc_size
值可能有助于提高性能,因为它可以减少服务器在查询执行操作期间执行内存分配的需要。
rand_seed1 |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
The rand_seed1
and rand_seed2
variables exist as session variables only, and can be set but not read. The variables—but not their values—are shown in the output of SHOW VARIABLES
.
The purpose of these variables is to support replication of the RAND()
function. For statements that invoke RAND()
, the source passes two values to the replica, where they are used to seed the random number generator. The replica uses these values to set the session variables rand_seed1
and rand_seed2
so that RAND()
on the replica generates the same value as on the source.
See the description for 请参阅rand_seed1
.rand_seed1
的说明。
--range-alloc-block-size=# |
|
range_alloc_block_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 4096 |
Minimum Value | 4096 |
Maximum Value (64-bit platforms) | 18446744073709547520 |
Maximum Value | 4294967295 |
Block Size | 1024 |
The size in bytes of blocks that are allocated when doing range optimization.进行范围优化时分配的块的大小(以字节为单位)。
--range-optimizer-max-mem-size=# |
|
range_optimizer_max_mem_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8388608 |
Minimum Value | 0 |
Maximum Value | 18446744073709551615 |
The limit on memory consumption for the range optimizer.范围优化器的内存消耗限制。A value of 0 means “no limit.” If an execution plan considered by the optimizer uses the range access method but the optimizer estimates that the amount of memory needed for this method would exceed the limit, it abandons the plan and considers other plans. 值0表示“没有限制”。如果优化器考虑的执行计划使用范围访问方法,但优化器估计此方法所需的内存量将超过限制,则会放弃该计划并考虑其他计划。For more information, see Limiting Memory Use for Range Optimization.有关详细信息,请参阅限制内存用于范围优化。
rbr_exec_mode |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | STRICT |
Valid Values |
|
For internal use by mysqlbinlog. This variable switches the server between IDEMPOTENT
mode and STRICT
mode. IDEMPOTENT
mode causes suppression of duplicate-key and no-key-found errors in BINLOG
statements generated by mysqlbinlog. This mode is useful when replaying a row-based binary log on a server that causes conflicts with existing data. mysqlbinlog sets this mode when you specify the --idempotent
option by writing the following to the output:
SET SESSION RBR_EXEC_MODE=IDEMPOTENT;
As of MySQL 8.0.18, setting the session value of this system variable is no longer a restricted operation.从MySQL 8.0.18开始,设置此系统变量的会话值不再是一项受限制的操作。
--read-buffer-size=# |
|
read_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 131072 |
Minimum Value | 8192 |
Maximum Value | 2147479552 |
Block Size | 4096 |
Each thread that does a sequential scan for a 对MyISAM
table allocates a buffer of this size (in bytes) for each table it scans.MyISAM
表进行顺序扫描的每个线程为其扫描的每个表分配一个大小(以字节为单位)的缓冲区。If you do many sequential scans, you might want to increase this value, which defaults to 131072. The value of this variable should be a multiple of 4KB. If it is set to a value that is not a multiple of 4KB, its value is rounded down to the nearest multiple of 4KB.如果进行多次顺序扫描,则可能需要增加此值,默认值为131072。此变量的值应该是4KB的倍数。如果将其设置为不是4KB倍数的值,则其值将四舍五入到最接近的4KB倍数。
This option is also used in the following context for all storage engines:此选项也用于所有存储引擎的以下上下文:
For caching the indexes in a temporary file (not a temporary table), when sorting rows for 用于缓存临时文件(而非临时表)中的索引,在为ORDER BY
.ORDER BY
排序行时使用。
For bulk insert into partitions.用于大容量插入分区。
For caching results of nested queries.用于缓存嵌套查询的结果。
read_buffer_size
is also used in one other storage engine-specific way: to determine the memory block size for MEMORY
tables.
Beginning with MySQL 8.0.22, the value of select_into_buffer_size
is used in place of the value of read_buffer_size
for the buffer used when executing SELECT INTO DUMPFILE
and SELECT INTO OUTFILE
statements.
For more information about memory use during different operations, see Section 8.12.3.1, “How MySQL Uses Memory”.有关不同操作期间内存使用的更多信息,请参阅第8.12.3.1节,“MySQL如何使用内存”。
--read-only[={OFF|ON}] |
|
read_only |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If the read_only
system variable is enabled, the server permits no client updates except from users who have the CONNECTION_ADMIN
privilege (or the deprecated SUPER
privilege). This variable is disabled by default.默认情况下,此变量处于禁用状态。
The server also supports a super_read_only
system variable (disabled by default), which has these effects:
If super_read_only
is enabled, the server prohibits client updates, even from users who have the CONNECTION_ADMIN
or SUPER
privilege.
Setting super_read_only
to ON
implicitly forces read_only
to ON
.
Setting read_only
to OFF
implicitly forces super_read_only
to OFF
.
When read_only
is enabled and when super_read_only
is enabled, the server still permits these operations:
Updates performed by replication threads, if the server is a replica. 如果服务器是复制副本,则由复制线程执行更新。In replication setups, it can be useful to enable read_only
on replica servers to ensure that replicas accept updates only from the source server and not from clients.
Writes to the system table mysql.gtid_executed
, which stores GTIDs for executed transactions that are not present in the current binary log file.
Use of ANALYZE TABLE
or OPTIMIZE TABLE
statements. The purpose of read-only mode is to prevent changes to table structure or contents. Analysis and optimization do not qualify as such changes. This means, for example, that consistency checks on read-only replicas can be performed with mysqlcheck --all-databases --analyze.
Operations on TEMPORARY
tables.TEMPORARY
表上的操作。
Inserts into the log tables (mysql.general_log
and mysql.slow_log
); see Section 5.4.1, “Selecting General Query Log and Slow Query Log Output Destinations”.
Updates to Performance Schema tables, such as UPDATE
or TRUNCATE TABLE
operations.
Changes to 对复制源服务器上read_only
on a replication source server are not replicated to replica servers.read_only
的更改不会复制到副本服务器。The value can be set on a replica independent of the setting on the source.可以在复制副本上设置该值,而与源上的设置无关。
The following conditions apply to attempts to enable read_only
(including implicit attempts resulting from enabling super_read_only
):
The attempt fails and an error occurs if you have any explicit locks (acquired with LOCK TABLES
) or have a pending transaction.
The attempt blocks while other clients have any ongoing statement, active 当其他客户端有任何正在进行的语句、活动的LOCK TABLES WRITE
, or ongoing commit, until the locks are released and the statements and transactions end. LOCK TABLES WRITE
或正在进行的提交时,尝试会被阻止,直到锁被释放,语句和事务结束。While the attempt to enable 当启用read_only
is pending, requests by other clients for table locks or to begin transactions also block until read_only
has been set.read_only
的尝试挂起时,其他客户端对表锁或开始事务的请求也会被阻止,直到设置了read_only
。
The attempt blocks if there are active transactions that hold metadata locks, until those transactions end.如果存在持有元数据锁的活动事务,则尝试将被阻止,直到这些事务结束。
read_only
can be enabled while you hold a global read lock (acquired with FLUSH TABLES WITH READ LOCK
) because that does not involve table locks.
--read-rnd-buffer-size=# |
|
read_rnd_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 262144 |
Minimum Value | 1 |
Maximum Value | 2147483647 |
This variable is used for reads from 此变量用于从MyISAM
tables, and, for any storage engine, for Multi-Range Read optimization.MyISAM
表中读取,对于任何存储引擎,用于多范围读取优化。
When reading rows from a 在执行键排序操作后,按排序顺序从MyISAM
table in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks.MyISAM
表中读取行时,会通过该缓冲区读取行,以避免磁盘查找。See Section 8.2.1.16, “ORDER BY Optimization”.请参阅第8.2.1.16节,“按优化排序”。Setting the variable to a large value can improve 将变量设置为较大的值可以大大提高ORDER BY
performance by a lot.ORDER BY
的性能。However, this is a buffer allocated for each client, so you should not set the global variable to a large value. Instead, change the session variable only from within those clients that need to run large queries.但是,这是为每个客户端分配的缓冲区,因此不应将全局变量设置为大值。相反,只从那些需要运行大型查询的客户端中更改会话变量。
For more information about memory use during different operations, see Section 8.12.3.1, “How MySQL Uses Memory”.有关不同操作期间内存使用的更多信息,请参阅第8.12.3.1节,“MySQL如何使用内存”。For information about Multi-Range Read optimization, see Section 8.2.1.11, “Multi-Range Read Optimization”.有关多量程读取优化的信息,请参阅第8.2.1.11节,“多量程读取最优化”。
--regexp-stack-limit=# |
|
regexp_stack_limit |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8000000 |
Minimum Value | 0 |
Maximum Value | 2147483647 |
The maximum available memory in bytes for the internal stack used for regular expression matching operations performed by 用于REGEXP_LIKE()
and similar functions (see Section 12.8.2, “Regular Expressions”).REGEXP_LIKE()
和类似函数执行的正则表达式匹配操作的内部堆栈的最大可用内存(以字节为单位)(请参阅第12.8.2节,“正则表达式”)。
--regexp-time-limit=# |
|
regexp_time_limit |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 32 |
Minimum Value | 0 |
Maximum Value | 2147483647 |
The time limit for regular expression matching operations performed by REGEXP_LIKE()
and similar functions (see Section 12.8.2, “Regular Expressions”).REGEXP_LIKE()
和类似函数执行的正则表达式匹配操作的时间限制(请参阅第12.8.2节,“正则表达式”)。This limit is expressed as the maximum permitted number of steps performed by the match engine, and thus affects execution time only indirectly. Typically, it is on the order of milliseconds.此限制表示为匹配引擎执行的最大允许步数,因此仅间接影响执行时间。通常,它的数量级为毫秒。
Introduced | 8.0.19 |
---|---|
require_row_format |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable is for internal server use by replication and mysqlbinlog. 此变量供复制和mysqlbinlog在服务器内部使用。It restricts DML events executed in the session to events encoded in row-based binary logging format only, and temporary tables cannot be created. Queries that do not respect the restrictions fail.它将会话中执行的DML事件限制为仅以基于行的二进制日志记录格式编码的事件,并且不能创建临时表。不遵守限制的查询将失败。
Setting the session value of this system variable to 将此系统变量的会话值设置为ON
requires no privileges. ON
不需要任何特权。Setting the session value of this system variable to 将此系统变量的会话值设置为OFF
is a restricted operation, and the session user must have privileges sufficient to set restricted session variables. OFF
是一项受限制的操作,会话用户必须具有足够的权限来设置受限制的会话变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
--require-secure-transport[={OFF|ON}] |
|
require_secure_transport |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether client connections to the server are required to use some form of secure transport. When this variable is enabled, the server permits only TCP/IP connections encrypted using TLS/SSL, or connections that use a socket file (on Unix) or shared memory (on Windows).是否需要客户端连接到服务器才能使用某种形式的安全传输。启用此变量后,服务器仅允许使用TLS/SSL加密的TCP/IP连接,或使用套接字文件(在Unix上)或共享内存(在Windows上)的连接。The server rejects nonsecure connection attempts, which fail with an 服务器拒绝不安全的连接尝试,尝试失败时会出现ER_SECURE_TRANSPORT_REQUIRED
error.ER_SECURE_TRANSPORT_REQUIRED
错误。
This capability supplements per-account SSL requirements, which take precedence.此功能补充了优先考虑的每个帐户SSL要求。For example, if an account is defined with REQUIRE SSL
, enabling require_secure_transport
does not make it possible to use the account to connect using a Unix socket file.
It is possible for a server to have no secure transports available. For example, a server on Windows supports no secure transports if started without specifying any SSL certificate or key files and with the 服务器可能没有可用的安全传输。例如,如果Windows上的服务器在未指定任何SSL证书或密钥文件且已禁用shared_memory
system variable disabled.shared_memory
系统变量的情况下启动,则不支持安全传输。Under these conditions, attempts to enable require_secure_transport
at startup cause the server to write a message to the error log and exit. Attempts to enable the variable at runtime fail with an ER_NO_SECURE_TRANSPORTS_CONFIGURED
error.
See also Configuring Encrypted Connections as Mandatory.另请参阅将加密连接配置为强制连接。
resultset_metadata |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | FULL |
Valid Values |
|
For connections for which metadata transfer is optional, the client sets the 对于元数据传输是可选的连接,客户端设置resultset_metadata
system variable to control whether the server returns result set metadata. resultset_metadata
系统变量以控一致性务器是否返回结果集元数据。Permitted values are 允许的值为FULL
(return all metadata; this is the default) and NONE
(return no metadata).FULL
(返回所有元数据;这是默认值)和NONE
(不返回元数据)。
For connections that are not metadata-optional, setting 对于非元数据可选的连接,将resultset_metadata
to NONE
produces an error.resultset_metadata
设置为NONE
会产生错误。
For details about managing result set metadata transfer, see Optional Result Set Metadata.有关管理结果集元数据传输的详细信息,请参阅可选结果集元数据。
secondary_engine_cost_threshold
Introduced | 8.0.16 |
---|---|
secondary_engine_cost_threshold |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Numeric |
Default Value | 100000.000000 |
Minimum Value | 0 |
Maximum Value | DBL_MAX (maximum double value) |
The optimizer cost threshold for query offload to a secondary engine.将查询卸载到辅助引擎的优化器成本阈值。
For use with HeatWave. See HeatWave User Guide.用于热浪。请参阅《热浪用户指南》。
--schema-definition-cache=# |
|
schema_definition_cache |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 256 |
Minimum Value | 256 |
Maximum Value | 524288 |
Defines a limit for the number of schema definition objects, both used and unused, that can be kept in the dictionary object cache.定义可以保存在字典对象缓存中的已使用和未使用的架构定义对象的数量限制。
Unused schema definition objects are only kept in the dictionary object cache when the number in use is less than the capacity defined by 只有当使用的数量小于schema_definition_cache
.schema_dition_cache
定义的容量时,未使用的架构定义对象才会保留在字典对象缓存中。
A setting of 设置为0
means that schema definition objects are only kept in the dictionary object cache while they are in use.0
意味着架构定义对象仅在使用时保留在字典对象缓存中。
For more information, see Section 14.4, “Dictionary Object Cache”.有关更多信息,请参阅第14.4节,“字典对象缓存”。
--secure-file-priv=dir_name |
|
secure_file_priv |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value | platform specific |
Valid Values |
|
This variable is used to limit the effect of data import and export operations, such as those performed by the LOAD DATA
and SELECT ... INTO OUTFILE
statements and the LOAD_FILE()
function. These operations are permitted only to users who have the FILE
privilege.
secure_file_priv
may be set as follows:
If empty, the variable has no effect. This is not a secure setting.如果为空,则变量无效。这不是一个安全的设置。
If set to the name of a directory, the server limits import and export operations to work only with files in that directory. The directory must exist; the server does not create it.如果设置为目录名,则服务器将导入和导出操作限制为仅使用该目录中的文件。目录必须存在;服务器不会创建它。
If set to 如果设置为NULL
, the server disables import and export operations.NULL
,则服务器将禁用导入和导出操作。
The default value is platform specific and depends on the value of the INSTALL_LAYOUT
CMake option, as shown in the following table. To specify the default secure_file_priv
value explicitly if you are building from source, use the INSTALL_SECURE_FILE_PRIVDIR
CMake option.
INSTALL_LAYOUT Value | Default secure_file_priv Value |
---|---|
STANDALONE | empty |
DEB , RPM , SVR4 | /var/lib/mysql-files |
Otherwise | mysql-files under the CMAKE_INSTALL_PREFIX value |
The server checks the value of 服务器在启动时检查secure_file_priv
at startup and writes a warning to the error log if the value is insecure. secure_file_priv
的值,如果该值不安全,则会在错误日志中写入警告。A non-如果非NULL
value is considered insecure if it is empty, or the value is the data directory or a subdirectory of it, or a directory that is accessible by all users. NULL
值为空,或者该值是数据目录或其子目录,或者是所有用户都可以访问的目录,则认为该值不安全。If 如果secure_file_priv
is set to a nonexistent path, the server writes an error message to the error log and exits.secure_file_priv
设置为不存在的路径,则服务器会在错误日志中写入一条错误消息并退出。
--select-into-buffer-size=# |
|
Introduced | 8.0.22 |
select_into_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 131072 |
Minimum Value | 8192 |
Maximum Value | 2147479552 |
Unit | bytes |
Block Size | 4096 |
When using 当使用SELECT INTO OUTFILE
or SELECT INTO DUMPFILE
to dump data into one or more files for backup creation, data migration, or other purposes, writes can often be buffered and then trigger a large burst of write I/O activity to the disk or other storage device and stall other queries that are more sensitive to latency. SELECT INTO OUTFILE
或SELECT INTO DUMPFILE
将数据转储到一个或多个文件中用于备份创建、数据迁移或其他目的时,写入通常会被缓冲,然后触发对磁盘或其他存储设备的大量写入I/O活动,并暂停对延迟更敏感的其他查询。You can use this variable to control the size of the buffer used to write data to the storage device to determine when buffer synchronization should occur, and thus to prevent write stalls of the kind just described from occurring.您可以使用此变量来控制用于向存储设备写入数据的缓冲区的大小,以确定何时应该进行缓冲区同步,从而防止发生刚才描述的那种写入暂停。
select_into_buffer_size
overrides any value set for read_buffer_size
. select_into_buffer_size
覆盖为read_buffer-size
设置的任何值。((select_into_buffer_size
and read_buffer_size
have the same default, maximum, and minimum values.) select_into_buffer_size
和read_buffer-size
具有相同的默认值、最大值和最小值。)You can also use 您也可以使用select_into_disk_sync_delay
to set a timeout to be observed afterwards, each time synchronization takes place.select_into_disk_sync_delay
来设置一个超时值,以便在每次同步后进行观察。
--select-into-disk-sync={ON|OFF} |
|
Introduced | 8.0.22 |
select_into_disk_sync |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
Valid Values |
|
When set on ON
, enables buffer synchronization of writes to an output file by a long-running SELECT INTO OUTFILE
or SELECT INTO DUMPFILE
statement using select_into_buffer_size
.
--select-into-disk-sync-delay=# |
|
Introduced | 8.0.22 |
select_into_disk_sync_delay |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 31536000 |
Unit | milliseconds |
When buffer synchronization of writes to an output file by a long-running SELECT INTO OUTFILE
or SELECT INTO DUMPFILE
statement is enabled by select_into_disk_sync
, this variable sets an optional delay (in milliseconds) following synchronization. 0
(the default) means no delay.
--session-track-gtids=value |
|
session_track_gtids |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | OFF |
Valid Values |
|
Controls whether the server returns GTIDs to the client, enabling the client to use them to track the server state. Depending on the variable value, at the end of executing each transaction, the server’s GTIDs are captured and returned to the client as part of the acknowledgement.控一致性务器是否向客户端返回GTID,使客户端能够使用它们来跟踪服务器状态。根据变量值,在执行每个事务结束时,服务器的GTID会被捕获并作为确认的一部分返回给客户端。The possible values for session_track_gtids
are as follows:session_track_gtids
的可能值如下:
OFF
: The server does not return GTIDs to the client. This is the default.:服务器不向客户端返回GTID。这是默认设置。
OWN_GTID
: The server returns the GTIDs for all transactions that were successfully committed by this client in its current session since the last acknowledgement.:服务器返回自上次确认以来此客户端在其当前会话中成功提交的所有事务的GTID。Typically, this is the single GTID for the last transaction committed, but if a single client request resulted in multiple transactions, the server returns a GTID set containing all the relevant GTIDs.通常,这是提交的最后一个事务的单个GTID,但如果单个客户端请求导致多个事务,则服务器会返回一个包含所有相关GTID的GTID集。
ALL_GTIDS
: The server returns the global value of its :服务器返回其gtid_executed
system variable, which it reads at a point after the transaction is successfully committed.gtid_executed
系统变量的全局值,该值在事务成功提交后读取。As well as the GTID for the transaction just committed, this GTID set includes all transactions committed on the server by any client, and can include transactions committed after the point when the transaction currently being acknowledged was committed.除了刚刚提交的事务的GTID外,该GTID集还包括任何客户端在服务器上提交的所有事务,并且可以包括在提交当前被确认的事务之后提交的事务。
不能在事务上下文中设置session_track_gtids
cannot be set within transactional context.session_track_gtids
。
For more information about session state tracking, see Section 5.1.18, “Server Tracking of Client Session State Changes”.有关会话状态跟踪的更多信息,请参阅第5.1.18节,“客户端会话状态更改的服务器跟踪”。
--session-track-schema[={OFF|ON}] |
|
session_track_schema |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
Controls whether the server tracks when the default schema (database) is set within the current session and notifies the client to make the schema name available.控一致性务器是否跟踪在当前会话中设置默认架构(数据库)的时间,并通知客户端使架构名称可用。
If the schema name tracker is enabled, name notification occurs each time the default schema is set, even if the new schema name is the same as the old.如果启用了架构名称跟踪器,则每次设置默认架构时都会发出名称通知,即使新的架构名称与旧的架构名称相同。
For more information about session state tracking, see Section 5.1.18, “Server Tracking of Client Session State Changes”.有关会话状态跟踪的更多信息,请参阅第5.1.18节,“客户端会话状态更改的服务器跟踪”。
--session-track-state-change[={OFF|ON}] |
|
session_track_state_change |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Controls whether the server tracks changes to the state of the current session and notifies the client when state changes occur. Changes can be reported for these attributes of client session state:控一致性务器是否跟踪对当前会话状态的更改,并在状态发生更改时通知客户端。可以报告客户端会话状态的这些属性的更改:
The default schema (database).默认架构(数据库)。
Session-specific values for system variables.系统变量的会话特定值。
User-defined variables.用户定义的变量。
Temporary tables.临时表格。
Prepared statements.准备好的发言。
If the session state tracker is enabled, notification occurs for each change that involves tracked session attributes, even if the new attribute values are the same as the old. For example, setting a user-defined variable to its current value results in a notification.如果启用了会话状态跟踪器,即使新的属性值与旧的属性值相同,也会为涉及跟踪的会话属性的每个更改发出通知。例如,将用户定义的变量设置为其当前值会导致通知。
The session_track_state_change
variable controls only notification of when changes occur, not what the changes are. session_track_state_change
变量仅控制何时发生更改的通知,而不控制更改内容。For example, state-change notifications occur when the default schema is set or tracked session system variables are assigned, but the notification does not include the schema name or variable values. 例如,当设置了默认模式或分配了跟踪会话系统变量,但通知中不包括模式名称或变量值时,会出现状态更改通知。To receive notification of the schema name or session system variable values, use the 要接收模式名称或会话系统变量值的通知,请分别使用session_track_schema
or session_track_system_variables
system variable, respectively.session_track_schema
或session_track _system_variables
系统变量。
Assigning a value to 将值分配给session_track_state_change
itself is not considered a state change and is not reported as such. session_track_state_change
本身不被视为状态更改,也不会报告为状态更改。However, if its name listed in the value of 但是,如果它的名称列在session_track_system_variables
, any assignments to it do result in notification of the new value.session_track_system_variables
的值中,则对它的任何赋值都会导致新值的通知。
For more information about session state tracking, see Section 5.1.18, “Server Tracking of Client Session State Changes”.有关会话状态跟踪的更多信息,请参阅第5.1.18节,“客户端会话状态更改的服务器跟踪”。
session_track_system_variables
--session-track-system-variables=# |
|
session_track_system_variables |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | time_zone, autocommit, character_set_client, character_set_results, character_set_connection |
Controls whether the server tracks assignments to session system variables and notifies the client of the name and value of each assigned variable. 控一致性务器是否跟踪对会话系统变量的分配,并将每个分配变量的名称和值通知客户端。The variable value is a comma-separated list of variables for which to track assignments. 变量值是一个逗号分隔的变量列表,用于跟踪分配。By default, notification is enabled for 默认情况下,会为time_zone
, autocommit
, character_set_client
, character_set_results
, and character_set_connection
. time_zone
、autocommit
、character_set_client
、character_set_results
和character_set_connection
启用通知。(The latter three variables are those affected by (后三个变量是受SET NAMES
.)SET NAMES
影响的变量。)
The special value 特殊值*
causes the server to track assignments to all session variables. *
使服务器跟踪对所有会话变量的分配。If given, this value must be specified by itself without specific system variable names.如果给定,则该值必须由其自身指定,而不使用特定的系统变量名。
To disable notification of session variable assignments, set 要禁用会话变量分配通知,请将session_track_system_variables
to the empty string.session_track_system_variables
设置为空字符串。
If session system variable tracking is enabled, notification occurs for all assignments to tracked session variables, even if the new values are the same as the old.如果启用了会话系统变量跟踪,则即使新值与旧值相同,也会为被跟踪会话变量的所有分配发出通知。
For more information about session state tracking, see Section 5.1.18, “Server Tracking of Client Session State Changes”.有关会话状态跟踪的更多信息,请参阅第5.1.18节,“客户端会话状态更改的服务器跟踪”。
session_track_transaction_info
--session-track-transaction-info=value |
|
session_track_transaction_info |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | OFF |
Valid Values |
|
Controls whether the server tracks the state and characteristics of transactions within the current session and notifies the client to make this information available. 控一致性务器是否跟踪当前会话中事务的状态和特征,并通知客户端使这些信息可用。These 允许这些session_track_transaction_info
values are permitted:session_track_transaction_info
值:
OFF
: Disable transaction state tracking. This is the default.:禁用事务状态跟踪。这是默认设置。
STATE
: Enable transaction state tracking without characteristics tracking. State tracking enables the client to determine whether a transaction is in progress and whether it could be moved to a different session without being rolled back.:启用事务状态跟踪,不进行特征跟踪。状态跟踪使客户端能够确定事务是否正在进行中,以及是否可以在不回滚的情况下将其移动到其他会话。
CHARACTERISTICS
: Enable transaction state tracking, including characteristics tracking. :启用交易状态跟踪,包括特征跟踪。Characteristics tracking enables the client to determine how to restart a transaction in another session so that it has the same characteristics as in the original session. 特征跟踪使客户端能够确定如何在另一个会话中重新启动事务,使其具有与原始会话中相同的特征。The following characteristics are relevant for this purpose:以下特征与此相关:
ISOLATION LEVEL READ ONLY READ WRITE WITH CONSISTENT SNAPSHOT
For a client to safely relocate a transaction to another session, it must track not only transaction state but also transaction characteristics. 为了让客户端安全地将事务重新定位到另一个会话,它不仅必须跟踪事务状态,还必须跟踪事务特征。In addition, the client must track the 此外,客户端必须跟踪transaction_isolation
and transaction_read_only
system variables to correctly determine the session defaults.transaction_inisolation
和transaction_read_only
系统变量,以正确确定会话默认值。 (To track these variables, list them in the value of the (要跟踪这些变量,请将它们列在session_track_system_variables
system variable.)session_track_system_variables
系统变量的值中。)
For more information about session state tracking, see Section 5.1.18, “Server Tracking of Client Session State Changes”.有关会话状态跟踪的更多信息,请参阅第5.1.18节,“客户端会话状态更改的服务器跟踪”。
sha256_password_auto_generate_rsa_keys
--sha256-password-auto-generate-rsa-keys[={OFF|ON}] |
|
sha256_password_auto_generate_rsa_keys |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
The server uses this variable to determine whether to autogenerate RSA private/public key-pair files in the data directory if they do not already exist.服务器使用此变量来确定是否在数据目录中自动生成RSA私钥/公钥对文件(如果这些文件不存在)。
At startup, the server automatically generates RSA private/public key-pair files in the data directory if all of these conditions are true: The sha256_password_auto_generate_rsa_keys
or caching_sha2_password_auto_generate_rsa_keys
system variable is enabled; no RSA options are specified; the RSA files are missing from the data directory. These key-pair files enable secure password exchange using RSA over unencrypted connections for accounts authenticated by the 这些密钥对文件使通过sha256_password
or caching_sha2_password
plugin; see Section 6.4.1.3, “SHA-256 Pluggable Authentication”, and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.sha256_password
或caching_sha2_password
插件验证的帐户能够通过未加密的连接使用RSA进行安全的密码交换;请参阅第6.4.1.3节,“SHA-256可插拔身份验证”和第6.4.1.2节,“缓存SHA-2可插拔身份认证”。
For more information about RSA file autogeneration, including file names and characteristics, see Section 6.3.3.1, “Creating SSL and RSA Certificates and Keys using MySQL”有关RSA文件自动生成的更多信息,包括文件名和特征,请参阅第6.3.3.1节,“使用MySQL创建SSL和RSA证书和密钥”。
The auto_generate_certs
system variable is related but controls autogeneration of SSL certificate and key files needed for secure connections using SSL.auto_generate_certs
系统变量是相关的,但控制使用SSL进行安全连接所需的SSL证书和密钥文件的自动生成。
sha256_password_private_key_path
--sha256-password-private-key-path=file_name |
|
sha256_password_private_key_path |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | private_key.pem |
The value of this variable is the path name of the RSA private key file for the 此变量的值是sha256_password
authentication plugin. sha256_password
身份验证插件的RSA私钥文件的路径名。If the file is named as a relative path, it is interpreted relative to the server data directory. The file must be in PEM format.如果将文件命名为相对路径,则会将其解释为相对于服务器数据目录。文件必须为PEM格式。
Because this file stores a private key, its access mode should be restricted so that only the MySQL server can read it.因为这个文件存储了一个私钥,所以它的访问模式应该受到限制,这样只有MySQL服务器才能读取它。
For information about 有关sha256_password
, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”.sha256_password
的信息,请参阅第6.4.1.3节,“SHA-256可插拔身份验证”。
--sha256-password-proxy-users[={OFF|ON}] |
|
sha256_password_proxy_users |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable controls whether the 此变量控制sha256_password
built-in authentication plugin supports proxy users. sha256_password
内置身份验证插件是否支持代理用户。It has no effect unless the 除非启用了check_proxy_users
system variable is enabled. check_proxy_users
系统变量,否则它将无效。For information about user proxying, see Section 6.2.18, “Proxy Users”.有关用户代理的信息,请参阅第6.2.18节,“代理用户”。
sha256_password_public_key_path
--sha256-password-public-key-path=file_name |
|
sha256_password_public_key_path |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | public_key.pem |
The value of this variable is the path name of the RSA public key file for the 此变量的值是sha256_password
authentication plugin. sha256_password
身份验证插件的RSA公钥文件的路径名。If the file is named as a relative path, it is interpreted relative to the server data directory. 如果将文件命名为相对路径,则会将其解释为相对于服务器数据目录。The file must be in PEM format. Because this file stores a public key, copies can be freely distributed to client users. 文件必须为PEM格式。因为此文件存储公钥,所以副本可以自由分发给客户端用户。(Clients that explicitly specify a public key when connecting to the server using RSA password encryption must use the same public key as that used by the server.)(使用RSA密码加密连接到服务器时明确指定公钥的客户端必须使用与服务器使用的公钥相同的公钥。)
For information about 有关sha256_password
, including information about how clients specify the RSA public key, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”.sha256_password
的信息,包括有关客户端如何指定RSA公钥的信息,请参阅第6.4.1.3节,“SHA-256可插拔身份验证”。
--shared-memory[={OFF|ON}] |
|
shared_memory |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Platform Specific | Windows |
Type | Boolean |
Default Value | OFF |
(Windows only.) Whether the server permits shared-memory connections.(仅限Windows。)服务器是否允许共享内存连接。
--shared-memory-base-name=name |
|
shared_memory_base_name |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Platform Specific | Windows |
Type | String |
Default Value | MYSQL |
(Windows only.) The name of shared memory to use for shared-memory connections. (仅限Windows。)用于共享内存连接的共享内存的名称。This is useful when running multiple MySQL instances on a single physical machine. The default name is 当在一台物理机器上运行多个MySQL实例时,这很有用。默认名称为MYSQL
. MYSQL
。The name is case-sensitive.该名称区分大小写。
This variable applies only if the server is started with the 仅当服务器启动时启用了shared_memory
system variable enabled to support shared-memory connections.shared_memory
系统变量以支持共享内存连接时,此变量才适用。
show_create_table_skip_secondary_engine
--show-create-table-skip-secondary-engine[={OFF|ON}] |
|
Introduced | 8.0.18 |
show_create_table_skip_secondary_engine |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
Enabling show_create_table_skip_secondary_engine
causes the SECONDARY ENGINE
clause to be excluded from SHOW CREATE TABLE
output, and from CREATE TABLE
statements dumped by the mysqldump utility.
mysqldump provides the --show-create-skip-secondary-engine
option. When specified, it enables the show_create_table_skip_secondary_engine
system variable for the duration of the dump operation.
Attempting a mysqldump operation with the --show-create-skip-secondary-engine
option on a release prior to MySQL 8.0.18 that does not support the show_create_table_skip_secondary_engine
variable causes an error.
For use with HeatWave. See HeatWave User Guide.
--show-create-table-verbosity[={OFF|ON}] |
|
show_create_table_verbosity |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
SHOW CREATE TABLE
normally does not show the ROW_FORMAT
table option if the row format is the default format. Enabling this variable causes SHOW CREATE TABLE
to display ROW_FORMAT
regardless of whether it is the default format.
--show-old-temporals[={OFF|ON}] |
|
Deprecated | Yes |
show_old_temporals |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether SHOW CREATE TABLE
output includes comments to flag temporal columns found to be in pre-5.6.4 format (TIME
, DATETIME
, and TIMESTAMP
columns without support for fractional seconds precision). This variable is disabled by default. If enabled, SHOW CREATE TABLE
output looks like this:
CREATE TABLE `mytbl` ( `ts` timestamp /* 5.5 binary format */ NOT NULL DEFAULT CURRENT_TIMESTAMP, `dt` datetime /* 5.5 binary format */ DEFAULT NULL, `t` time /* 5.5 binary format */ DEFAULT NULL ) DEFAULT CHARSET=utf8mb4
Output for the COLUMN_TYPE
column of the INFORMATION_SCHEMA.COLUMNS
table is affected similarly.
This variable is deprecated; expect it to be removed in a future MySQL release.此变量已弃用;期望它在未来的MySQL版本中被删除。
--skip-external-locking[={OFF|ON}] |
|
skip_external_locking |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
This is OFF
if mysqld uses external locking (system locking), ON
if external locking is disabled. This affects only MyISAM
table access.
This variable is set by the --external-locking
or --skip-external-locking
option. External locking is disabled by default.
External locking affects only MyISAM
table access. For more information, including conditions under which it can and cannot be used, see Section 8.11.5, “External Locking”.
--skip-name-resolve[={OFF|ON}] |
|
skip_name_resolve |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether to resolve host names when checking client connections. If this variable is OFF
, mysqld resolves host names when checking client connections. If it is ON
, mysqld uses only IP numbers; in this case, all Host
column values in the grant tables must be IP addresses. See Section 5.1.12.3, “DNS Lookups and the Host Cache”.
Depending on the network configuration of your system and the Host
values for your accounts, clients may need to connect using an explicit --host
option, such as --host=127.0.0.1
or --host=::1
.
An attempt to connect to the host 127.0.0.1
normally resolves to the localhost
account. However, this fails if the server is run with skip_name_resolve
enabled. If you plan to do that, make sure an account exists that can accept a connection. For example, to be able to connect as root
using --host=127.0.0.1
or --host=::1
, create these accounts:
CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY 'root-password
'; CREATE USER 'root'@'::1' IDENTIFIED BY 'root-password
';
--skip-networking[={OFF|ON}] |
|
skip_networking |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable controls whether the server permits TCP/IP connections. By default, it is disabled (permit TCP connections). If enabled, the server permits only local (non-TCP/IP) connections and all interaction with mysqld must be made using named pipes or shared memory (on Windows) or Unix socket files (on Unix). This option is highly recommended for systems where only local clients are permitted. See Section 5.1.12.3, “DNS Lookups and the Host Cache”.
Because starting the server with --skip-grant-tables
disables authentication checks, the server also disables remote connections in that case by enabling skip_networking
.
--skip-show-database |
|
skip_show_database |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This prevents people from using the 如果没有SHOW DATABASES
statement if they do not have the SHOW DATABASES
privilege. SHOW DATABASES
权限,这将阻止用户使用SHOW DATABASES
语句。This can improve security if you have concerns about users being able to see databases belonging to other users. 如果您担心用户能够看到属于其他用户的数据库,这可以提高安全性。Its effect depends on the SHOW DATABASES
privilege: If the variable value is ON
, the SHOW DATABASES
statement is permitted only to users who have the SHOW DATABASES
privilege, and the statement displays all database names. If the value is OFF
, SHOW DATABASES
is permitted to all users, but displays the names of only those databases for which the user has the SHOW DATABASES
or other privilege.
Because any static global privilege is considered a privilege for all databases, any static global privilege enables a user to see all database names with 由于任何静态全局特权都被视为所有数据库的特权,因此任何静态全局权限都允许用户使用SHOW DATABASES
or by examining the SCHEMATA
table of INFORMATION_SCHEMA
, except databases that have been restricted at the database level by partial revokes.SHOW DATABASES
或通过检查INFORMATION_SCHEMA
的SCHEMATA
表来查看所有数据库名称,但在数据库级别受到部分吊销限制的数据库除外。
--slow-launch-time=# |
|
slow_launch_time |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 2 |
If creating a thread takes longer than this many seconds, the server increments the 如果创建线程的时间超过这几秒,则服务器会递增Slow_launch_threads
status variable.Slow_launch_threads
状态变量。
--slow-query-log[={OFF|ON}] |
|
slow_query_log |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Whether the slow query log is enabled. The value can be 0 (or OFF
) to disable the log or 1 (or ON
) to enable the log. The destination for log output is controlled by the log_output
system variable; if that value is NONE
, no log entries are written even if the log is enabled.
“Slow” is determined by the value of the “慢速”由long_query_time
variable. long_query_time
变量的值决定。See Section 5.4.5, “The Slow Query Log”.请参阅第5.4.5节,“慢速查询日志”。
--slow-query-log-file=file_name |
|
slow_query_log_file |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | host_name-slow.log |
The name of the slow query log file. 慢速查询日志文件的名称。The default value is
, but the initial value can be changed with the host_name
-slow.log--slow_query_log_file
option.
--socket={file_name|pipe_name} |
|
socket |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value (Windows) | MySQL |
Default Value (Other) | /tmp/mysql.sock |
On Unix platforms, this variable is the name of the socket file that is used for local client connections. The default is /tmp/mysql.sock
. (For some distribution formats, the directory might be different, such as /var/lib/mysql
for RPMs.)
On Windows, this variable is the name of the named pipe that is used for local client connections. The default value is 在Windows上,此变量是用于本地客户端连接的命名管道的名称。默认值为MySQL
(not case-sensitive).MySQL
(不区分大小写)。
--sort-buffer-size=# |
|
sort_buffer_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 262144 |
Minimum Value | 32768 |
Maximum Value (Windows) | 4294967295 |
Maximum Value (Other, 64-bit platforms) | 18446744073709551615 |
Maximum Value (Other, 32-bit platforms) | 4294967295 |
Each session that must perform a sort allocates a buffer of this size. 每个必须执行排序的会话都会分配一个此大小的缓冲区。sort_buffer_size
is not specific to any storage engine and applies in a general manner for optimization. sort_buffer_size
不特定于任何存储引擎,而是以通用方式应用于优化。At minimum the sort_buffer_size
value must be large enough to accommodate fifteen tuples in the sort buffer. sort_buffer_size
值至少必须足够大,以便在排序缓冲区中容纳十五个元组。Also, increasing the value of 此外,增加max_sort_length
may require increasing the value of sort_buffer_size
. max_sort_length
的值可能需要增加sort_buffer_size
的值。For more information, see Section 8.2.1.16, “ORDER BY Optimization”有关更多信息,请参阅第8.2.1.16节,“ORDER BY优化”。
If you see many Sort_merge_passes
per second in SHOW GLOBAL STATUS
output, you can consider increasing the sort_buffer_size
value to speed up ORDER BY
or GROUP BY
operations that cannot be improved with query optimization or improved indexing.
The optimizer tries to work out how much space is needed but can allocate more, up to the limit. Setting it larger than required globally slows down most queries that perform sorts. It is best to increase it as a session setting, and only for the sessions that need a larger size. 优化器试图计算出需要多少空间,但可以分配更多的空间,达到极限。将其全局设置为大于所需的值会减慢大多数执行排序的查询的速度。最好将其增加为会话设置,并且仅适用于需要更大大小的会话。On Linux, there are thresholds of 256KB and 2MB where larger values may significantly slow down memory allocation, so you should consider staying below one of those values. 在Linux上,有256KB和2MB的阈值,较大的值可能会显著降低内存分配速度,因此您应该考虑保持在其中一个值以下。Experiment to find the best value for your workload. See Section B.3.3.5, “Where MySQL Stores Temporary Files”.尝试为您的工作量找到最佳价值。请参阅B.3.3.5节,“MySQL存储临时文件的位置”。
The maximum permissible setting for sort_buffer_size
is 4GB−1. Larger values are permitted for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB−1 with a warning).sort_buffer_size
的最大允许设置为4GB-1。64位平台允许使用较大的值(64位Windows除外,对于64位Windows,较大的值会截断为4GB-1并发出警告)。
sql_auto_is_null |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
If this variable is enabled, then after a statement that successfully inserts an automatically generated 如果启用了此变量,那么在成功插入自动生成的AUTO_INCREMENT
value, you can find that value by issuing a statement of the following form:AUTO_INCREMENT
值的语句之后,您可以通过发出以下形式的语句来找到该值:
SELECT * FROMtbl_name
WHEREauto_col
IS NULL
If the statement returns a row, the value returned is the same as if you invoked the LAST_INSERT_ID()
function. For details, including the return value after a multiple-row insert, see Section 12.16, “Information Functions”. If no AUTO_INCREMENT
value was successfully inserted, the SELECT
statement returns no row.
The behavior of retrieving an AUTO_INCREMENT
value by using an IS NULL
comparison is used by some ODBC programs, such as Access. See Obtaining Auto-Increment Values. This behavior can be disabled by setting sql_auto_is_null
to OFF
.
Prior to MySQL 8.0.16, the transformation of WHERE
to auto_col
IS NULLWHERE
was performed only when the statement was executed, so that the value of auto_col
= LAST_INSERT_ID()sql_auto_is_null
during execution determined whether the query was transformed. In MySQL 8.0.16 and later, the transformation is performed during statement preparation.在MySQL 8.0.16及更高版本中,转换是在语句准备过程中执行的。
The default value of sql_auto_is_null
is OFF
.sql_auto_is_null
的默认值为OFF
。
sql_big_selects |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | ON |
If set to OFF
, MySQL aborts SELECT
statements that are likely to take a very long time to execute (that is, statements for which the optimizer estimates that the number of examined rows exceeds the value of max_join_size
). This is useful when an inadvisable WHERE
statement has been issued. The default value for a new connection is ON
, which permits all SELECT
statements.
If you set the max_join_size
system variable to a value other than DEFAULT
, sql_big_selects
is set to OFF
.
sql_buffer_result |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
If enabled, sql_buffer_result
forces results from SELECT
statements to be put into temporary tables. This helps MySQL free the table locks early and can be beneficial in cases where it takes a long time to send results to the client. The default value is OFF
.
sql_log_off |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Valid Values |
|
This variable controls whether logging to the general query log is disabled for the current session (assuming that the general query log itself is enabled). 此变量控制当前会话是否禁用对常规查询日志的日志记录(假设启用了常规查询日志本身)。The default value is 默认值为OFF
(that is, enable logging). OFF
(即启用日志记录)。To disable or enable general query logging for the current session, set the session 要禁用或启用当前会话的常规查询日志记录,请将会话sql_log_off
variable to ON
or OFF
.sql_log_off
变量设置为ON
或OFF
。
Setting the session value of this system variable is a restricted operation. 设置此系统变量的会话值是一项受限制的操作。The session user must have privileges sufficient to set restricted session variables. 会话用户必须具有足够的权限来设置受限制的会话变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
--sql-mode=name |
|
sql_mode |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Set |
Default Value | ONLY_FULL_GROUP_BY STRICT_TRANS_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE ERROR_FOR_DIVISION_BY_ZERO NO_ENGINE_SUBSTITUTION |
Valid Values |
|
The current server SQL mode, which can be set dynamically. 当前服务器SQL模式,可以动态设置。For details, see Section 5.1.11, “Server SQL Modes”.有关详细信息,请参阅第5.1.11节,“服务器SQL模式”。
MySQL installation programs may configure the SQL mode during the installation process.MySQL安装程序可能会在安装过程中配置SQL模式。
If the SQL mode differs from the default or from what you expect, check for a setting in an option file that the server reads at startup.如果SQL模式与默认模式或预期模式不同,请检查服务器在启动时读取的选项文件中的设置。
sql_notes |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
If enabled (the default), diagnostics of 如果已启用(默认设置),则“注释”级别的诊断将递增Note
level increment warning_count
and the server records them. warning_count
,服务器将记录它们。If disabled, 如果禁用,请注意诊断不会增加Note
diagnostics do not increment warning_count
and the server does not record them. warning_count
,服务器也不会记录它们。mysqldump includes output to disable this variable so that reloading the dump file does not produce warnings for events that do not affect the integrity of the reload operation.mysqldump包含禁用此变量的输出,以便重新加载转储文件不会对不影响重新加载操作完整性的事件产生警告。
sql_quote_show_create |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
If enabled (the default), the server quotes identifiers for 如果启用(默认设置),服务器会引用SHOW CREATE TABLE
and SHOW CREATE DATABASE
statements. SHOW CREATE TABLE
和SHOW CREATE DATABASE
语句的标识符。If disabled, quoting is disabled. This option is enabled by default so that replication works for identifiers that require quoting. 如果禁用,则禁用引用。默认情况下启用此选项,以便复制适用于需要引用的标识符。See Section 13.7.7.10, “SHOW CREATE TABLE Statement”, and Section 13.7.7.6, “SHOW CREATE DATABASE Statement”.请参阅第13.7.7.10节,“SHOW CREATE TABLE语句”和第13.7.7.6节,“SHOW CREATE DATABASE语句”。
--sql-require-primary-key[={OFF|ON}] |
|
Introduced | 8.0.13 |
sql_require_primary_key |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
Whether statements that create new tables or alter the structure of existing tables enforce the requirement that tables have a primary key.无论是创建新表的语句还是更改现有表的结构的语句,都会强制要求表具有主键。
Setting the session value of this system variable is a restricted operation. 设置此系统变量的会话值是一项受限制的操作。The session user must have privileges sufficient to set restricted session variables. 会话用户必须具有足够的权限来设置受限制的会话变量。See Section 5.1.9.1, “System Variable Privileges”.请参阅第5.1.9.1节,“系统变量权限”。
Enabling this variable helps avoid performance problems in row-based replication that can occur when tables have no primary key. Suppose that a table has no primary key and an update or delete modifies multiple rows. 启用此变量有助于避免表没有主键时可能出现的基于行的复制中的性能问题。假设一个表没有主键,更新或删除会修改多行。On the replication source server, this operation can be performed using a single table scan but, when replicated using row-based replication, results in a table scan for each row to be modified on the replica. With a primary key, these table scans do not occur.在复制源服务器上,可以使用单个表扫描执行此操作,但如果使用基于行的复制进行复制,则会对复制副本上要修改的每一行进行表扫描。对于主键,这些表扫描不会发生。
sql_require_primary_key
applies to both base tables and TEMPORARY
tables, and changes to its value are replicated to replica servers. sql_require_primary_key
同时应用于基表和TEMPORARY表,对其值的更改将复制到副本服务器。As of MySQL 8.0.18, it applies only to storage engines that can participate in replication.从MySQL 8.0.18开始,它仅适用于可以参与复制的存储引擎。
When enabled, 启用后,sql_require_primary_key
has these effects:sql_require_primary_key
具有以下效果:
Attempts to create a new table with no primary key fail with an error. 尝试创建没有主键的新表失败,并出现错误。This includes CREATE TABLE ... LIKE
. It also includes CREATE TABLE ... SELECT
, unless the CREATE TABLE
part includes a primary key definition.
Attempts to drop the primary key from an existing table fail with an error, with the exception that dropping the primary key and adding a primary key in the same 从现有表中删除主键的尝试失败,并出现错误,但允许在同一ALTER TABLE
statement is permitted.ALTER TABLE
语句中删除主键并添加主键。
Dropping the primary key fails even if the table also contains a 即使表还包含UNIQUE NOT NULL
index.UNIQUE NOT NULL
索引,删除主键也会失败。
Attempts to import a table with no primary key fail with an error.尝试导入没有主键的表失败,并出现错误。
The REQUIRE_TABLE_PRIMARY_KEY_CHECK
option of the CHANGE REPLICATION SOURCE TO
statement (from MySQL 8.0.23) or CHANGE MASTER TO
statement (before MySQL 8.0.23) enables a replica to select its own policy for primary key checks. When the option is set to ON
for a replication channel, the replica always uses the value ON
for the sql_require_primary_key
system variable in replication operations, requiring a primary key. When the option is set to OFF
, the replica always uses the value OFF
for the sql_require_primary_key
system variable in replication operations, so that a primary key is never required, even if the source required one. When the REQUIRE_TABLE_PRIMARY_KEY_CHECK
option is set to STREAM
, which is the default, the replica uses whatever value is replicated from the source for each transaction. With the STREAM
setting for the REQUIRE_TABLE_PRIMARY_KEY_CHECK
option, if privilege checks are in use for the replication channel, the PRIVILEGE_CHECKS_USER
account needs privileges sufficient to set restricted session variables, so that it can set the session value for the sql_require_primary_key
system variable. With the 使用ON
or OFF
settings, the account does not need these privileges. For more information, see Section 17.3.3, “Replication Privilege Checks”.ON
或OFF
设置,帐户不需要这些权限。有关更多信息,请参阅第17.3.3节,“复制权限检查”。
sql_safe_updates |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | OFF |
If this variable is enabled, UPDATE
and DELETE
statements that do not use a key in the WHERE
clause or a LIMIT
clause produce an error. This makes it possible to catch UPDATE
and DELETE
statements where keys are not used properly and that would probably change or delete a large number of rows. The default value is OFF
.
For the mysql client, sql_safe_updates
can be enabled by using the --safe-updates
option. For more information, see Using Safe-Updates Mode (--safe-updates).
sql_select_limit |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
The maximum number of rows to return from SELECT
statements. For more information, see Using Safe-Updates Mode (--safe-updates).
The default value for a new connection is the maximum number of rows that the server permits per table. 新连接的默认值是服务器允许的每个表的最大行数。Typical default values are (232)−1 or (264)−1. If you have changed the limit, the default value can be restored by assigning a value of DEFAULT
.
If a SELECT
has a LIMIT
clause, the LIMIT
takes precedence over the value of sql_select_limit
.
sql_warnings |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
This variable controls whether single-row INSERT
statements produce an information string if warnings occur. The default is OFF
. Set the value to 将该值设置为ON以生成信息字符串。ON
to produce an information string.
--ssl-ca=file_name |
|
ssl_ca |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The path name of the Certificate Authority (CA) certificate file in PEM format. The file contains a list of trusted SSL Certificate Authorities.PEM格式的证书颁发机构(CA)证书文件的路径名。该文件包含受信任的SSL证书颁发机构的列表。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
--ssl-capath=dir_name |
|
ssl_capath |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | |
Default Value | NULL |
The path name of the directory that contains trusted SSL Certificate Authority (CA) certificate files in PEM format.包含PEM格式的受信任SSL证书颁发机构(CA)证书文件的目录的路径名。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
--ssl-cert=file_name |
|
ssl_cert |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The path name of the server SSL public key certificate file in PEM format.PEM格式的服务器SSL公钥证书文件的路径名。
If the server is started with 如果服务器启动时将ssl_cert
set to a certificate that uses any restricted cipher or cipher category, the server starts with support for encrypted connections disabled. ssl_cert
设置为使用任何受限密码或密码类别的证书,则服务器启动时禁用对加密连接的支持。For information about cipher restrictions, see Connection Cipher Configuration.有关密码限制的信息,请参阅连接密码配置。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
--ssl-cipher=name |
|
ssl_cipher |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value | NULL |
The list of permissible encryption ciphers for connections that use TLS protocols up through TLSv1.2. 使用TLS协议直至TLSv1.2的连接的允许加密密码列表。If no cipher in the list is supported, encrypted connections that use these TLS protocols do not work.如果列表中不支持密码,则使用这些TLS协议的加密连接将不起作用。
For greatest portability, the cipher list should be a list of one or more cipher names, separated by colons. Examples:为了实现最大的可移植性,密码列表应该是一个或多个密码名称的列表,用冒号分隔。示例:
[mysqld] ssl_cipher="AES128-SHA" ssl_cipher="DHE-RSA-AES128-GCM-SHA256:AES128-SHA"
OpenSSL supports the syntax for specifying ciphers described in the OpenSSL documentation at https://www.openssl.org/docs/manmaster/man1/ciphers.html.OpenSSL支持OpenSSL文档中描述的用于指定密码的语法,网址为https://www.openssl.org/docs/manmaster/man1/ciphers.html。
For information about which encryption ciphers MySQL supports, see Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.有关MySQL支持哪些加密密码的信息,请参阅第6.3.2节,“加密连接TLS协议和密码”。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
--ssl-crl=file_name |
|
ssl_crl |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The path name of the file containing certificate revocation lists in PEM format.包含PEM格式的证书吊销列表的文件的路径名。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
--ssl-crlpath=dir_name |
|
ssl_crlpath |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | Directory name |
Default Value | NULL |
The path of the directory that contains certificate revocation-list files in PEM format.包含PEM格式的证书吊销列表文件的目录的路径。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. Prior to MySQL 8.0.16, this variable can be set only at server startup.
--ssl-fips-mode={OFF|ON|STRICT} |
|
ssl_fips_mode |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | OFF |
Valid Values |
|
Controls whether to enable FIPS mode on the server side. 控制是否在服务器端启用FIPS模式。The ssl_fips_mode
system variable differs from other ssl_
system variables in that it is not used to control whether the server permits encrypted connections, but rather to affect which cryptographic operations are permitted. See Section 6.8, “FIPS Support”.xxx
These ssl_fips_mode
values are permitted:
OFF
(or 0): Disable FIPS mode.
ON
(or 1): Enable FIPS mode.
STRICT
(or 2): Enable “strict” FIPS mode.
If the OpenSSL FIPS Object Module is not available, the only permitted value for ssl_fips_mode
is OFF
. In this case, setting ssl_fips_mode
to ON
or STRICT
at startup causes the server to produce an error message and exit.
--ssl-key=file_name |
|
ssl_key |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | File name |
Default Value | NULL |
The path name of the server SSL private key file in PEM format. For better security, use a certificate with an RSA key size of at least 2048 bits.PEM格式的服务器SSL私钥文件的路径名。为了提高安全性,请使用RSA密钥大小至少为2048位的证书。
If the key file is protected by a passphrase, the server prompts the user for the passphrase. The password must be given interactively; it cannot be stored in a file. If the passphrase is incorrect, the program continues as if it could not read the key.如果密钥文件受密码短语保护,则服务器会提示用户输入密码短语。密码必须以交互方式提供;它不能存储在文件中。如果密码短语不正确,程序将继续运行,就像无法读取密钥一样。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
--stored-program-cache=# |
|
stored_program_cache |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 256 |
Minimum Value | 16 |
Maximum Value | 524288 |
Sets a soft upper limit for the number of cached stored routines per connection. The value of this variable is specified in terms of the number of stored routines held in each of the two caches maintained by the MySQL Server for, respectively, stored procedures and stored functions.设置每个连接的缓存存储例程数的软上限。此变量的值是根据MySQL Server分别为存储过程和存储函数维护的两个缓存中的每个缓存中存储例程的数量来指定的。
Whenever a stored routine is executed this cache size is checked before the first or top-level statement in the routine is parsed; if the number of routines of the same type (stored procedures or stored functions according to which is being executed) exceeds the limit specified by this variable, the corresponding cache is flushed and memory previously allocated for cached objects is freed. This allows the cache to be flushed safely, even when there are dependencies between stored routines.每当执行存储的例程时,在解析例程中的第一个或顶级语句之前检查该缓存大小;如果同一类型的例程(执行所依据的存储过程或存储函数)的数量超过该变量指定的限制,则会刷新相应的缓存,并释放先前为缓存对象分配的内存。这允许安全地刷新缓存,即使存储的例程之间存在依赖关系。
The stored procedure and stored function caches exists in parallel with the stored program definition cache partition of the dictionary object cache. 存储过程和存储函数缓存与字典对象缓存的存储程序定义缓存分区并行存在。The stored procedure and stored function caches are per connection, while the stored program definition cache is shared. The existence of objects in the stored procedure and stored function caches have no dependence on the existence of objects in the stored program definition cache, and vice versa. 存储过程和存储函数缓存是每个连接的,而存储的程序定义缓存是共享的。存储过程和存储函数缓存中对象的存在与存储程序定义缓存中对象存在无关,反之亦然。For more information, see Section 14.4, “Dictionary Object Cache”.有关更多信息,请参阅第14.4节,“字典对象缓存”。
stored_program_definition_cache
--stored-program-definition-cache=# |
|
stored_program_definition_cache |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 256 |
Minimum Value | 256 |
Maximum Value | 524288 |
Defines a limit for the number of stored program definition objects, both used and unused, that can be kept in the dictionary object cache.定义可以保存在字典对象缓存中的已使用和未使用的存储程序定义对象的数量限制。
Unused stored program definition objects are only kept in the dictionary object cache when the number in use is less than the capacity defined by 只有当使用的数量小于stored_program_definition_cache
.stored_program_definition_cache
定义的容量时,未使用的存储程序定义对象才会保留在字典对象缓存中。
A setting of 0 means that stored program definition objects are only kept in the dictionary object cache while they are in use.设置为0意味着存储的程序定义对象在使用时仅保留在字典对象缓存中。
The stored program definition cache partition exists in parallel with the stored procedure and stored function caches that are configured using the 存储程序定义缓存分区与使用stored_program_cache
option.stored_program_cache
选项配置的存储过程和存储函数缓存并行存在。
The stored_program_cache
option sets a soft upper limit for the number of cached stored procedures or functions per connection, and the limit is checked each time a connection executes a stored procedure or function. stored_program_cache
选项为每个连接缓存的存储过程或函数的数量设置了一个软上限,每次连接执行存储过程或功能时都会检查该限制。The stored program definition cache partition, on the other hand, is a shared cache that stores stored program definition objects for other purposes. 另一方面,存储程序定义缓存分区是一个共享缓存,用于存储用于其他目的的存储程序定义对象。The existence of objects in the stored program definition cache partition has no dependence on the existence of objects in the stored procedure cache or stored function cache, and vice versa.对象在存储程序定义缓存分区中的存在与对象在存储过程缓存或存储函数缓存中的存在无关,反之亦然。
For related information, see Section 14.4, “Dictionary Object Cache”.有关相关信息,请参阅第14.4节,“字典对象缓存”。
--super-read-only[={OFF|ON}] |
|
super_read_only |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
If the read_only
system variable is enabled, the server permits no client updates except from users who have the CONNECTION_ADMIN
privilege (or the deprecated SUPER
privilege). If the super_read_only
system variable is also enabled, the server prohibits client updates even from users who have CONNECTION_ADMIN
or SUPER
. See the description of the read_only
system variable for a description of read-only mode and information about how read_only
and super_read_only
interact.
Client updates prevented when super_read_only
is enabled include operations that do not necessarily appear to be updates, such as CREATE FUNCTION
(to install a loadable function), INSTALL PLUGIN
, and INSTALL COMPONENT
. These operations are prohibited because they involve changes to tables in the mysql
system schema.
Similarly, if the Event Scheduler is enabled, enabling the super_read_only
system variable prevents it from updating event “last executed” timestamps in the events
data dictionary table. This causes the Event Scheduler to stop the next time it tries to execute a scheduled event, after writing a message to the server error log. If super_read_only
is subsequently disabled, the server automatically restarts the Event Scheduler as needed, as of MySQL 8.0.26. Prior to MySQL 8.0.26, it is necessary to manually restart the Event Scheduler by enabling it again.在MySQL 8.0.26之前,有必要通过再次启用事件调度程序来手动重新启动它。
Changes to 仅在复制源服务器上对super_read_only
on a replication source server are not replicated to replica servers. The value can be set on a replica independent of the setting on the source.super_read_only
所做的更改不会复制到副本服务器。可以在复制副本上设置该值,而与源上的设置无关。
--syseventlog.facility=value |
|
Introduced | 8.0.13 |
syseventlog.facility |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | daemon |
The facility for error log output written to 将错误日志输出写入syslog
(what type of program is sending the message). syslog
的功能(发送消息的程序类型)。This variable is unavailable unless the 除非安装了log_sink_syseventlog
error log component is installed. log_sink_syseventlog
错误日志组件,否则此变量不可用。See Section 5.4.2.8, “Error Logging to the System Log”.请参阅第5.4.2.8节,“系统日志的错误记录”。
The permitted values can vary per operating system; consult your system 允许的值可能因操作系统而异;请参阅系统syslog
documentation.syslog
文档。
This variable does not exist on Windows.此变量在Windows上不存在。
--syseventlog.include-pid[={OFF|ON}] |
|
Introduced | 8.0.13 |
syseventlog.include_pid |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
Whether to include the server process ID in each line of error log output written to 是否在写入syslog
. syslog
的错误日志输出的每一行中包括服务器进程ID。This variable is unavailable unless the 除非安装了log_sink_syseventlog
error log component is installed. log_sink_syseventlog
错误日志组件,否则此变量不可用。See Section 5.4.2.8, “Error Logging to the System Log”.请参阅第5.4.2.8节,“系统日志的错误记录”。
This variable does not exist on Windows.此变量在Windows上不存在。
--syseventlog.tag=tag |
|
Introduced | 8.0.13 |
syseventlog.tag |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | empty string |
The tag to be added to the server identifier in error log output written to 要添加到写入syslog
or the Windows Event Log. This variable is unavailable unless the log_sink_syseventlog
error log component is installed. syslog
或Windows事件日志的错误日志输出中的服务器标识符的标记。除非安装了log_sink_syseventlog
错误日志组件,否则此变量不可用。See Section 5.4.2.8, “Error Logging to the System Log”.请参阅第5.4.2.8节,“系统日志的错误记录”。
By default, no tag is set, so the server identifier is simply 默认情况下,没有设置标记,因此服务器标识符在Windows上只是MySQL
on Windows, and mysqld
on other platforms. MySQL
,在其他平台上是mysqld
。If a tag value of tag
is specified, it is appended to the server identifier with a leading hyphen, resulting in a syslog
identifier of mysqld-
(or tag
MySQL-
on Windows).tag
On Windows, to use a tag that does not already exist, the server must be run from an account with Administrator privileges, to permit creation of a registry entry for the tag. Elevated privileges are not required if the tag already exists.在Windows上,要使用不存在的标记,必须从具有管理员权限的帐户运行服务器,才能为标记创建注册表项。如果标记已经存在,则不需要提升权限。
system_time_zone |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The server system time zone. When the server begins executing, it inherits a time zone setting from the machine defaults, possibly modified by the environment of the account used for running the server or the startup script. 服务器系统时区。当服务器开始执行时,它会从机器默认值继承时区设置,该设置可能会被用于运行服务器或启动脚本的帐户的环境修改。The value is used to set 该值用于设置system_time_zone
. system_time_zone
。Typically the time zone is specified by the 通常,时区由TZ
environment variable. TZ
环境变量指定。It also can be specified using the 也可以使用mysqld_safe脚本的--timezone
option of the mysqld_safe script.--timezone
选项指定它。
As of MySQL 8.0.26, in addition to startup time initialization, if the server host time zone changes (for example, due to daylight saving time), 从MySQL 8.0.26开始,除了启动时间初始化外,如果服务器主机时区发生变化(例如,由于夏令时),system_time_zone
reflects that change.system_time_zone
也会反映该变化。
The system_time_zone
variable differs from time_zone
. system_time_zone
变量与time_zone
不同。Although they might have the same value, the latter variable is used to initialize the time zone for each client that connects. See Section 5.1.15, “MySQL Server Time Zone Support”.尽管它们可能具有相同的值,但后一个变量用于初始化连接的每个客户端的时区。请参阅第5.1.15节,“MySQL Server时区支持”。
--table-definition-cache=# |
|
table_definition_cache |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | -1 |
Minimum Value | 400 |
Maximum Value | 524288 |
The number of table definitions that can be stored in the definition cache. If you use a large number of tables, you can create a large table definition cache to speed up opening of tables. 可以存储在定义缓存中的表定义数。如果使用大量表,可以创建大型表定义缓存以加快打开表的速度。The table definition cache takes less space and does not use file descriptors, unlike the normal table cache. The minimum value is 400. The default value is based on the following formula, capped to a limit of 2000:与普通表缓存不同,表定义缓存占用的空间较小,并且不使用文件描述符。最小值为400。默认值基于以下公式,上限为2000:
MIN(400 + table_open_cache / 2, 2000)
For InnoDB
, table_definition_cache
acts as a soft limit for the number of open table instances in the InnoDB
data dictionary cache. If the number of open table instances exceeds the table_definition_cache
setting, the LRU mechanism begins to mark table instances for eviction and eventually removes them from the data dictionary cache. The limit helps address situations in which significant amounts of memory would be used to cache rarely used table instances until the next server restart. 该限制有助于解决在下次服务器重新启动之前,大量内存将用于缓存很少使用的表实例的情况。The number of table instances with cached metadata could be higher than the limit defined by 具有缓存元数据的表实例的数量可能高于table_definition_cache
, because parent and child table instances with foreign key relationships are not placed on the LRU list and are not subject to eviction from memory.table_definition_cache
定义的限制,因为具有外键关系的父表实例和子表实例不会放在LRU列表上,也不会从内存中逐出。
Additionally, table_definition_cache
defines a soft limit for the number of InnoDB
file-per-table tablespaces that can be open at one time, which is also controlled by innodb_open_files
. If both table_definition_cache
and innodb_open_files
are set, the highest setting is used. If neither variable is set, table_definition_cache
, which has a higher default value, is used. If the number of open tablespace file handles exceeds the limit defined by table_definition_cache
or innodb_open_files
, the LRU mechanism searches the tablespace file LRU list for files that are fully flushed and are not currently being extended. This process is performed each time a new tablespace is opened. If there are no “inactive” tablespaces, no tablespace files are closed.如果没有“非活动”表空间,则不会关闭任何表空间文件。
The table definition cache exists in parallel with the table definition cache partition of the dictionary object cache. 表定义缓存与字典对象缓存的表定义缓存分区并行存在。Both caches store table definitions but serve different parts of the MySQL server. Objects in one cache have no dependence on the existence objects in the other. 这两个缓存都存储表定义,但为MySQL服务器的不同部分提供服务。一个缓存中的对象不依赖于另一个缓存的存在对象。For more information, see Section 14.4, “Dictionary Object Cache”.有关更多信息,请参阅第14.4节,“字典对象缓存”。
table_encryption_privilege_check
--table-encryption-privilege-check[={OFF|ON}] |
|
Introduced | 8.0.16 |
table_encryption_privilege_check |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
Controls the TABLE_ENCRYPTION_ADMIN
privilege check that occurs when creating or altering a schema or general tablespace with encryption that differs from the default_table_encryption
setting, or when creating or altering a table with an encryption setting that differs from the default schema encryption. The check is disabled by default.
Setting table_encryption_privilege_check
at runtime requires the SUPER
privilege.
table_encryption_privilege_check
supports SET PERSIST
and SET PERSIST_ONLY
syntax. See Section 5.1.9.3, “Persisted System Variables”.
For more information, see Defining an Encryption Default for Schemas and General Tablespaces.
--table-open-cache=# |
|
table_open_cache |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 4000 |
Minimum Value | 1 |
Maximum Value | 524288 |
The number of open tables for all threads. 所有线程打开的表数。Increasing this value increases the number of file descriptors that mysqld requires. 增加这个值会增加mysqld所需的文件描述符的数量。You can check whether you need to increase the table cache by checking the 您可以通过检查Opened_tables
status variable. Opened_tables
状态变量来检查是否需要增加表缓存。See Section 5.1.10, “Server Status Variables”. 请参阅第5.1.10节,“服务器状态变量”。If the value of 如果Opened_tables
is large and you do not use FLUSH TABLES
often (which just forces all tables to be closed and reopened), then you should increase the value of the table_open_cache
variable. Opened_tables
的值很大,并且不经常使用FLUSH TABLES
(这只是强制关闭并重新打开所有表),则应增加table_open_cache
变量的值。For more information about the table cache, see Section 8.4.3.1, “How MySQL Opens and Closes Tables”.有关表缓存的更多信息,请参阅第8.4.3.1节,“MySQL如何打开和关闭表”。
--table-open-cache-instances=# |
|
table_open_cache_instances |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 16 |
Minimum Value | 1 |
Maximum Value | 64 |
The number of open tables cache instances. 打开的表缓存实例的数量。To improve scalability by reducing contention among sessions, the open tables cache can be partitioned into several smaller cache instances of size 为了通过减少会话之间的争用来提高可扩展性,可以将开放表缓存划分为几个较小的缓存实例,大小为table_open_cache
/ table_open_cache_instances
. table_open_cache
/table_open_cachi_instances
。A session needs to lock only one instance to access it for DML statements. 会话只需要锁定一个实例,就可以为DML语句访问它。This segments cache access among instances, permitting higher performance for operations that use the cache when there are many sessions accessing tables. 这样可以在实例之间分割缓存访问,从而在有许多会话访问表时,允许使用缓存的操作具有更高的性能。(DDL statements still require a lock on the entire cache, but such statements are much less frequent than DML statements.)(DDL语句仍然需要对整个缓存进行锁定,但此类语句的频率远低于DML语句。)
A value of 8 or 16 is recommended on systems that routinely use 16 or more cores.对于常规使用16个或更多核心的系统,建议使用8或16的值。
--tablespace-definition-cache=# |
|
tablespace_definition_cache |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 256 |
Minimum Value | 256 |
Maximum Value | 524288 |
Defines a limit for the number of tablespace definition objects, both used and unused, that can be kept in the dictionary object cache.定义可以保存在字典对象缓存中的表空间定义对象的数量限制,包括已使用和未使用的对象。
Unused tablespace definition objects are only kept in the dictionary object cache when the number in use is less than the capacity defined by 未使用的表空间定义对象只有在使用的数量小于tablespace_definition_cache
.tablespace_definition_cache
定义的容量时才会保留在字典对象缓存中。
A setting of 设置为0
means that tablespace definition objects are only kept in the dictionary object cache while they are in use.0
意味着表空间定义对象在使用时只保留在字典对象缓存中。
For more information, see Section 14.4, “Dictionary Object Cache”.有关更多信息,请参阅第14.4节,“字典对象缓存”。
--temptable-max-mmap=# |
|
Introduced | 8.0.23 |
temptable_max_mmap |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1073741824 |
Minimum Value | 0 |
Maximum Value | 2^64-1 |
Defines the maximum amount of memory (in bytes) the TempTable storage engine is permitted to allocate from memory-mapped temporary files before it starts storing data to 定义TempTable存储引擎在开始将数据存储到磁盘上的InnoDB
internal temporary tables on disk. InnoDB
内部临时表之前,允许从内存映射的临时文件中分配的最大内存量(以字节为单位)。A setting of 0 disables allocation of memory from memory-mapped temporary files. 设置为0将禁用从内存映射的临时文件中分配内存。For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.有关更多信息,请参阅第8.4.4节,“MySQL中的内部临时表使用”。
--temptable-max-ram=# |
|
temptable_max_ram |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1073741824 |
Minimum Value | 2097152 |
Maximum Value | 2^64-1 |
Defines the maximum amount of memory that can be occupied by the TempTable
storage engine before it starts storing data on disk. The default value is 1073741824 bytes (1GiB). For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.
--temptable-use-mmap[={OFF|ON}] |
|
Introduced | 8.0.16 |
Deprecated | 8.0.26 |
temptable_use_mmap |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | ON |
Defines whether the TempTable storage engine allocates space for internal in-memory temporary tables as memory-mapped temporary files when the amount of memory occupied by the TempTable storage engine exceeds the limit defined by the 定义当TempTable存储引擎占用的内存量超过temptable_max_ram
variable. temptable_max_ram
变量定义的限制时,TempTable存储发动机是否为内存中的内部临时表分配空间作为内存映射的临时文件。When 当temptable_use_mmap
is disabled, the TempTable storage engine uses InnoDB
on-disk internal temporary tables instead. temptable_use_mmap
被禁用时,temptable存储引擎使用磁盘上的InnoDB
内部临时表。For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.有关更多信息,请参阅第8.4.4节,“MySQL中的内部临时表使用”。
--thread-cache-size=# |
|
thread_cache_size |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | -1 |
Minimum Value | 0 |
Maximum Value | 16384 |
How many threads the server should cache for reuse. When a client disconnects, the client's threads are put in the cache if there are fewer than 服务器应该缓存多少个线程以供重用。当客户端断开连接时,如果缓存中的线程少于thread_cache_size
threads there. thread_cache_size
,则会将客户端的线程放入缓存中。Requests for threads are satisfied by reusing threads taken from the cache if possible, and only when the cache is empty is a new thread created. 如果可能的话,通过重用从缓存中获取的线程来满足对线程的请求,并且只有当缓存为空时才创建新的线程。This variable can be increased to improve performance if you have a lot of new connections. 如果有很多新连接,可以增加此变量以提高性能。Normally, this does not provide a notable performance improvement if you have a good thread implementation. 通常,如果您有一个好的线程实现,这不会显著提高性能。However, if your server sees hundreds of connections per second you should normally set 但是,如果服务器每秒看到数百个连接,通常应该将thread_cache_size
high enough so that most new connections use cached threads. thread_cache_size
设置得足够高,以便大多数新连接使用缓存的线程。By examining the difference between the 通过检查Connections
and Threads_created
status variables, you can see how efficient the thread cache is. Connections
和Threads_created
状态变量之间的差异,可以了解线程缓存的效率。For details, see Section 5.1.10, “Server Status Variables”.有关详细信息,请参阅第5.1.10节,“服务器状态变量”。
The default value is based on the following formula, capped to a limit of 100:默认值基于以下公式,上限为100:
8 + (max_connections / 100)
--thread-handling=name |
|
thread_handling |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | one-thread-per-connection |
Valid Values |
|
The thread-handling model used by the server for connection threads. 服务器用于连接线程的线程处理模型。The permissible values are 允许的值是no-threads
(the server uses a single thread to handle one connection), one-thread-per-connection
(the server uses one thread to handle each client connection), and loaded-dynamically
(set by the thread pool plugin when it initializes). no-threads
(服务器使用单个线程来处理一个连接)、one-thread-per-connection
(服务器用一个线程来处理每个客户端连接)和loaded-dynamically
(由线程池插件初始化时设置)。no-threads
is useful for debugging under Linux; see Section 5.9, “Debugging MySQL”.no-threads
可用于Linux下的调试;请参阅第5.9节,“调试MySQL”。
--thread-pool-algorithm=# |
|
thread_pool_algorithm |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 1 |
This variable controls which algorithm the thread pool plugin uses:此变量控制线程池插件使用的算法:
A value of 0 (the default) uses a conservative low-concurrency algorithm which is most well tested and is known to produce very good results.值为0(默认值)使用保守的低并发算法,该算法经过了最充分的测试,并且可以产生非常好的结果。
A value of 1 increases the concurrency and uses a more aggressive algorithm which at times has been known to perform 5–10% better on optimal thread counts, but has degrading performance as the number of connections increases. 值为1会增加并发性,并使用更激进的算法,该算法有时在最佳线程数上的性能会提高510%,但随着连接数量的增加,性能会降低。Its use should be considered as experimental and not supported.它的使用应被视为实验性的,不受支持。
This variable is available only if the thread pool plugin is enabled. 仅当启用线程池插件时,此变量才可用。See Section 5.6.3, “MySQL Enterprise Thread Pool”.请参阅第5.6.3节,“MySQL企业线程池”。
thread_pool_high_priority_connection
--thread-pool-high-priority-connection=# |
|
thread_pool_high_priority_connection |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 1 |
This variable affects queuing of new statements prior to execution. 此变量影响执行前新语句的排队。If the value is 0 (false, the default), statement queuing uses both the low-priority and high-priority queues. If the value is 1 (true), queued statements always go to the high-priority queue.如果值为0(默认值为false
),则语句队列同时使用低优先级和高优先级队列。如果值为1(true
),则排队的语句总是转到高优先级队列。
This variable is available only if the thread pool plugin is enabled. 仅当启用线程池插件时,此变量才可用。See Section 5.6.3, “MySQL Enterprise Thread Pool”.请参阅第5.6.3节,“MySQL企业线程池”。
thread_pool_max_active_query_threads
--thread-pool-max-active-query-threads |
|
Introduced | 8.0.19 |
thread_pool_max_active_query_threads |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 512 |
The maximum permissible number of active (running) query threads per group. If the value is 0, the thread pool plugin uses up to as many threads as are available.每个组允许的最大活动(运行)查询线程数。如果值为0,则线程池插件将使用尽可能多的可用线程。
This variable is available only if the thread pool plugin is enabled. See Section 5.6.3, “MySQL Enterprise Thread Pool”.仅当启用线程池插件时,此变量才可用。请参阅第5.6.3节,“MySQL企业线程池”。
thread_pool_max_unused_threads
--thread-pool-max-unused-threads=# |
|
thread_pool_max_unused_threads |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 4096 |
The maximum permitted number of unused threads in the thread pool. This variable makes it possible to limit the amount of memory used by sleeping threads.线程池中允许的最大未使用线程数。这个变量可以限制睡眠线程使用的内存量。
A value of 0 (the default) means no limit on the number of sleeping threads. 值为0(默认值)意味着睡眠线程的数量没有限制。A value of N
where N
is greater than 0 means 1 consumer thread and N
−1 reserve threads. In this case, if a thread is ready to sleep but the number of sleeping threads is already at the maximum, the thread exits rather than going to sleep.
A sleeping thread is either sleeping as a consumer thread or a reserve thread. The thread pool permits one thread to be the consumer thread when sleeping. 睡眠线程要么作为使用者线程睡眠,要么作为保留线程睡眠。线程池允许一个线程在睡眠时作为使用者线程。If a thread goes to sleep and there is no existing consumer thread, it sleeps as a consumer thread. 如果一个线程进入睡眠状态,并且没有现有的使用者线程,那么它将作为使用者线程睡眠。When a thread must be woken up, a consumer thread is selected if there is one. A reserve thread is selected only when there is no consumer thread to wake up.当一个线程必须被唤醒时,如果有使用者线程,就会选择一个使用者线程。只有当没有要唤醒的使用者线程时,才会选择保留线程。
This variable is available only if the thread pool plugin is enabled. 仅当启用线程池插件时,此变量才可用。See Section 5.6.3, “MySQL Enterprise Thread Pool”.请参阅第5.6.3节,“MySQL企业线程池”。
--thread-pool-prio-kickup-timer=# |
|
thread_pool_prio_kickup_timer |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 1000 |
Minimum Value | 0 |
Maximum Value | 4294967294 |
This variable affects statements waiting for execution in the low-priority queue. The value is the number of milliseconds before a waiting statement is moved to the high-priority queue. The default is 1000 (1 second).此变量影响在低优先级队列中等待执行的语句。该值是等待语句移动到高优先级队列之前的毫秒数。默认值为1000(1秒)。
This variable is available only if the thread pool plugin is enabled. 仅当启用线程池插件时,此变量才可用。See Section 5.6.3, “MySQL Enterprise Thread Pool”.请参阅第5.6.3节,“MySQL企业线程池”。
--thread-pool-size=# |
|
thread_pool_size |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 16 |
Minimum Value | 1 |
Maximum Value (≥ 8.0.19) | 512 |
Maximum Value (≤ 8.0.18) | 64 |
The number of thread groups in the thread pool. This is the most important parameter controlling thread pool performance. 线程池中线程组的数目。这是控制线程池性能的最重要的参数。It affects how many statements can execute simultaneously. 它影响可以同时执行的语句数。If a value outside the range of permissible values is specified, the thread pool plugin does not load and the server writes a message to the error log.如果指定了超出允许值范围的值,则不会加载线程池插件,服务器会在错误日志中写入消息。
This variable is available only if the thread pool plugin is enabled. 仅当启用线程池插件时,此变量才可用。See Section 5.6.3, “MySQL Enterprise Thread Pool”.请参阅第5.6.3节,“MySQL企业线程池”。
--thread-pool-stall-limit=# |
|
thread_pool_stall_limit |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 6 |
Minimum Value | 4 |
Maximum Value | 600 |
This variable affects executing statements. The value is the amount of time a statement has to finish after starting to execute before it becomes defined as stalled, at which point the thread pool permits the thread group to begin executing another statement. 此变量影响执行语句。该值是一条语句在开始执行后,在被定义为停滞之前必须完成的时间量,此时线程池允许线程组开始执行另一条语句。The value is measured in 10 millisecond units, so the default of 6 means 60ms. Short wait values permit threads to start more quickly. 该值以10毫秒为单位进行测量,因此默认值6表示60毫秒。短等待值允许线程更快地启动。Short values are also better for avoiding deadlock situations. Long wait values are useful for workloads that include long-running statements, to avoid starting too many new statements while the current ones execute.短值对于避免死锁情况也更好。长等待值对于包含长时间运行语句的工作负载非常有用,以避免在执行当前语句时启动过多的新语句。
This variable is available only if the thread pool plugin is enabled. 仅当启用线程池插件时,此变量才可用。See Section 5.6.3, “MySQL Enterprise Thread Pool”.请参阅第5.6.3节,“MySQL企业线程池”。
--thread-stack=# |
|
thread_stack |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value (64-bit platforms) | 286720 |
Default Value (32-bit platforms) | 221184 |
Minimum Value | 131072 |
Maximum Value (64-bit platforms) | 18446744073709547520 |
Maximum Value (32-bit platforms) | 4294967295 |
Block Size | 1024 |
The stack size for each thread. The default is large enough for normal operation. If the thread stack size is too small, it limits the complexity of the SQL statements that the server can handle, the recursion depth of stored procedures, and other memory-consuming actions.每个线程的堆栈大小。默认值足够大,可以正常操作。如果线程堆栈大小太小,则会限一致性务器可以处理的SQL语句的复杂性、存储过程的递归深度以及其他消耗内存的操作。
time_zone |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies (≥ 8.0.17) | Yes |
SET_VAR Hint Applies (≤ 8.0.16) | No |
Type | String |
Default Value | SYSTEM |
Minimum Value (≥ 8.0.19) | -13:59 |
Minimum Value (≤ 8.0.18) | -12:59 |
Maximum Value (≥ 8.0.19) | +14:00 |
Maximum Value (≤ 8.0.18) | +13:00 |
The current time zone. This variable is used to initialize the time zone for each client that connects. 当前时区。此变量用于初始化连接的每个客户端的时区。By default, the initial value of this is 默认情况下,它的初始值为'SYSTEM'
(which means, “use the value of system_time_zone
”). 'SYSTEM'
(意思是“使用system_time_zone
的值”)。The value can be specified explicitly at server startup with the 该值可以在服务器启动时使用--default-time-zone
option. --default-time-zone
选项显式指定。See Section 5.1.15, “MySQL Server Time Zone Support”.请参阅第5.1.15节,“MySQL Server时区支持”。
If set to 如果设置为SYSTEM
, every MySQL function call that requires a time zone calculation makes a system library call to determine the current system time zone. This call may be protected by a global mutex, resulting in contention.SYSTEM
,则每个需要时区计算的MySQL函数调用都会进行系统库调用,以确定当前系统时区。此调用可能受到全局互斥的保护,从而导致争用。
timestamp |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Numeric |
Default Value | UNIX_TIMESTAMP() |
Minimum Value | 1 |
Maximum Value | 2147483647 |
Set the time for this client. This is used to get the original timestamp if you use the binary log to restore rows. 设置此客户端的时间。如果您使用二进制日志来恢复行,则使用它来获取原始时间戳。timestamp_value
should be a Unix epoch timestamp (a value like that returned by UNIX_TIMESTAMP()
, not a value in '
format) or YYYY-MM-DD hh:mm:ss
'DEFAULT
.
Setting timestamp
to a constant value causes it to retain that value until it is changed again. Setting timestamp
to DEFAULT
causes its value to be the current date and time as of the time it is accessed.
timestamp
is a DOUBLE
rather than BIGINT
because its value includes a microseconds part. The maximum value corresponds to '2038-01-19 03:14:07'
UTC, the same as for the TIMESTAMP
data type.
SET timestamp
affects the value returned by NOW()
but not by SYSDATE()
. This means that timestamp settings in the binary log have no effect on invocations of SYSDATE()
. The server can be started with the --sysdate-is-now
option to cause SYSDATE()
to be a synonym for NOW()
, in which case SET timestamp
affects both functions.
--tls-ciphersuites=ciphersuite_list |
|
Introduced | 8.0.16 |
tls_ciphersuites |
|
Global | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | String |
Default Value | NULL |
Which ciphersuites the server permits for encrypted connections that use TLSv1.3. The value is a list of zero or more colon-separated ciphersuite names.服务器允许哪些密码套件用于使用TLSv1.3的加密连接。该值是一个由零个或多个冒号分隔的密码套件名称组成的列表。
The ciphersuites that can be named for this variable depend on the SSL library used to compile MySQL. 可以为此变量命名的密码套件取决于用于编译MySQL的SSL库。If this variable is not set, its default value is 如果未设置此变量,则其默认值为NULL
, which means that the server permits the default set of ciphersuites. NULL
,这意味着服务器允许默认的密码套件集。If the variable is set to the empty string, no ciphersuites are enabled and encrypted connections cannot be established. 如果变量设置为空字符串,则不会启用密码套件,也无法建立加密连接。For more information, see Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.有关更多信息,请参阅第6.3.2节,“加密连接TLS协议和密码”。
--tls-version=protocol_list |
|
tls_version |
|
Global | |
Dynamic (≥ 8.0.16) | Yes |
Dynamic (≤ 8.0.15) | No |
SET_VAR Hint Applies | No |
Type | String |
Default Value (≥ 8.0.16) |
|
Default Value (≤ 8.0.15) | TLSv1,TLSv1.1,TLSv1.2 |
Which protocols the server permits for encrypted connections. The value is a list of one or more comma-separated protocol names. 服务器允许哪些协议用于加密连接。该值是一个或多个逗号分隔的协议名称的列表。The protocols that can be named for this variable depend on the SSL library used to compile MySQL. 可以为此变量命名的协议取决于用于编译MySQL的SSL库。Permitted protocols should be chosen such as not to leave “holes” in the list. 应选择允许的协议,以免在列表中留下“漏洞”。For details, see Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.有关详细信息,请参阅第6.3.2节,“加密连接TLS协议和密码”。
As of MySQL 8.0.16, this variable is dynamic and can be modified at runtime to affect the TSL context the server uses for new connections. 从MySQL 8.0.16开始,此变量是动态的,可以在运行时进行修改,以影响服务器用于新连接的TSL上下文。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections. 请参阅服务器端运行时配置和监视加密连接。Prior to MySQL 8.0.16, this variable can be set only at server startup.在MySQL 8.0.16之前,此变量只能在服务器启动时设置。
As of MySQL 8.0.26, the TLSv1 and TLSv1.1 connection protocols are deprecated and support for them is subject to removal in a future version of MySQL. See Deprecated TLS Protocols.从MySQL 8.0.26开始,TLSv1和TLSv1.1连接协议已被弃用,对它们的支持可能会在未来版本的MySQL中删除。请参阅不推荐的TLS协议。
--tmp-table-size=# |
|
tmp_table_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Integer |
Default Value | 16777216 |
Minimum Value | 1024 |
Maximum Value | 18446744073709551615 |
The maximum size of internal in-memory temporary tables. This variable does not apply to user-created 内存中内部临时表的最大大小。此变量不适用于用户创建的MEMORY
tables.MEMORY
表。
The actual limit is the smaller of tmp_table_size
and max_heap_table_size
. When an in-memory temporary table exceeds the limit, MySQL automatically converts it to an on-disk temporary table.当内存中的临时表超过限制时,MySQL会自动将其转换为磁盘上的临时表。
Increase the value of tmp_table_size
(and max_heap_table_size
if necessary) if you do many advanced GROUP BY
queries and you have lots of memory.
You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing Created_tmp_disk_tables
and Created_tmp_tables
values.
See also Section 8.4.4, “Internal Temporary Table Use in MySQL”.另请参见第8.4.4节,“MySQL中的内部临时表使用”。
--tmpdir=dir_name |
|
tmpdir |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | Directory name |
The path of the directory to use for creating temporary files. 用于创建临时文件的目录的路径。It might be useful if your default 如果您的默认/tmp
directory resides on a partition that is too small to hold temporary tables. /tmp
目录所在的分区太小,无法容纳临时表,那么这可能会很有用。This variable can be set to a list of several paths that are used in round-robin fashion. 此变量可以设置为以循环方式使用的几个路径的列表。Paths should be separated by colon characters (路径应在Unix上用冒号字符(:
) on Unix and semicolon characters (;
) on Windows.:
)分隔,在Windows上用分号字符(;
)分隔。
tmpdir
can be a non-permanent location, such as a directory on a memory-based file system or a directory that is cleared when the server host restarts. tmpdir
可以是一个非永久位置,例如基于内存的文件系统上的目录,或者在服务器主机重新启动时清除的目录。If the MySQL server is acting as a replica, and you are using a non-permanent location for tmpdir
, consider setting a different temporary directory for the replica using the slave_load_tmpdir
variable. For a replica, the temporary files used to replicate LOAD DATA
statements are stored in this directory, so with a permanent location they can survive machine restarts, although replication can now continue after a restart if the temporary files have been removed.
For more information about the storage location of temporary files, see Section B.3.3.5, “Where MySQL Stores Temporary Files”.有关临时文件存储位置的更多信息,请参阅B.3.3.5节,“MySQL存储临时文件的位置”。
--transaction-alloc-block-size=# |
|
transaction_alloc_block_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 8192 |
Minimum Value | 1024 |
Maximum Value | 131072 |
Block Size | 1024 |
The amount in bytes by which to increase a per-transaction memory pool which needs memory. See the description of 需要内存的每个事务内存池增加的字节数。请参阅transaction_prealloc_size
.transaction_precalloc_size
的说明。
--transaction-isolation=name |
|
transaction_isolation |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Enumeration |
Default Value | REPEATABLE-READ |
Valid Values |
|
The transaction isolation level. The default is 事务隔离级别。默认值为REPEATABLE-READ
.REPEATABLE-READ
。
The transaction isolation level has three scopes: global, session, and next transaction. 事务隔离级别有三个作用域:全局、会话和下一个事务。This three-scope implementation leads to some nonstandard isolation-level assignment semantics, as described later.这三个范围的实现导致了一些非标准的隔离级别赋值语义,如后面所述。
To set the global transaction isolation level at startup, use the --transaction-isolation
server option.
At runtime, the isolation level can be set directly using the SET
statement to assign a value to the transaction_isolation
system variable, or indirectly using the SET TRANSACTION
statement. If you set transaction_isolation
directly to an isolation level name that contains a space, the name should be enclosed within quotation marks, with the space replaced by a dash. For example, use this SET
statement to set the global value:
SET GLOBAL transaction_isolation = 'READ-COMMITTED';
Setting the global 设置全局transaction_isolation
value sets the isolation level for all subsequent sessions. Existing sessions are unaffected.transaction_isolation
值可设置所有后续会话的隔离级别。现有会话不受影响。
To set the session or next-level 要设置会话或下一级transaction_isolation
value, use the SET
statement. For most session system variables, these statements are equivalent ways to set the value:transaction_instance
值,请使用SET
语句。对于大多数会话系统变量,这些语句是设置值的等效方法:
SET @@SESSION.var_name
=value
; SET SESSIONvar_name
=value
; SETvar_name
=value
; SET @@var_name
=value
;
As mentioned previously, the transaction isolation level has a next-transaction scope, in addition to the global and session scopes. 如前所述,除了全局作用域和会话作用域之外,事务隔离级别还有下一个事务作用域。To enable the next-transaction scope to be set, 为了能够设置下一个事务作用域,用于分配会话系统变量值的SET
syntax for assigning session system variable values has nonstandard semantics for transaction_isolation
:SET
语法具有transaction_instance
的非标准语义:
To set the session isolation level, use any of these syntaxes:要设置会话隔离级别,请使用以下任意语法:
SET @@SESSION.transaction_isolation =value
; SET SESSION transaction_isolation =value
; SET transaction_isolation =value
;
For each of those syntaxes, these semantics apply:对于这些语法中的每一种,都应用以下语义:
Sets the isolation level for all subsequent transactions performed within the session.为会话中执行的所有后续事务设置隔离级别。
Permitted within transactions, but does not affect the current ongoing transaction.交易中允许,但不影响当前正在进行的交易。
If executed between transactions, overrides any preceding statement that sets the next-transaction isolation level.如果在事务之间执行,则覆盖设置下一个事务隔离级别的任何先前语句。
Corresponds to SET SESSION TRANSACTION ISOLATION LEVEL
(with the SESSION
keyword).
To set the next-transaction isolation level, use this syntax:要设置下一个事务隔离级别,请使用以下语法:
SET @@transaction_isolation = value
;
For that syntax, these semantics apply:对于该语法,以下语义适用:
Sets the isolation level only for the next single transaction performed within the session.仅为会话中执行的下一个单个事务设置隔离级别。
Subsequent transactions revert to the session isolation level.后续事务将恢复到会话隔离级别。
Not permitted within transactions.交易中不允许。
Corresponds to SET TRANSACTION ISOLATION LEVEL
(without the SESSION
keyword).
For more information about SET TRANSACTION
and its relationship to the transaction_isolation
system variable, see Section 13.3.7, “SET TRANSACTION Statement”.
--transaction-prealloc-size=# |
|
transaction_prealloc_size |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 4096 |
Minimum Value | 1024 |
Maximum Value | 131072 |
Block Size | 1024 |
There is a per-transaction memory pool from which various transaction-related allocations take memory. 有一个每个事务的内存池,各种与事务相关的分配从中获取内存。The initial size of the pool in bytes is 池的初始大小(以字节为单位)为transaction_prealloc_size
. transaction_precalloc_size
。For every allocation that cannot be satisfied from the pool because it has insufficient memory available, the pool is increased by 对于由于可用内存不足而无法从池中满足的每个分配,池将增加transaction_alloc_block_size
bytes. transaction_alloc_block_size
字节。When the transaction ends, the pool is truncated to 当事务结束时,池将被截断为transaction_prealloc_size
bytes.transaction_prealloc_size
字节。
By making 通过使transaction_prealloc_size
sufficiently large to contain all statements within a single transaction, you can avoid many malloc()
calls.transaction_prealloc_size
足够大以包含单个事务中的所有语句,可以避免多次malloc()
调用。
--transaction-read-only[={OFF|ON}] |
|
transaction_read_only |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Boolean |
Default Value | OFF |
The transaction access mode. The value can be 事务访问模式。该值可以是OFF
(read/write; the default) or ON
(read only).OFF
(读/写;默认值)或ON
(只读)。
The transaction access mode has three scopes: global, session, and next transaction. This three-scope implementation leads to some nonstandard access-mode assignment semantics, as described later.事务访问模式有三个作用域:全局、会话和下一个事务。这种三范围的实现导致了一些非标准的访问模式分配语义,如后面所述。
To set the global transaction access mode at startup, use the 要在启动时设置全局事务访问模式,请使用--transaction-read-only
server option.--transaction-read-only
服务器选项。
At runtime, the access mode can be set directly using the SET
statement to assign a value to the transaction_read_only
system variable, or indirectly using the SET TRANSACTION
statement. For example, use this SET
statement to set the global value:
SET GLOBAL transaction_read_only = ON;
Setting the global 设置全局transaction_read_only
value sets the access mode for all subsequent sessions. Existing sessions are unaffected.transaction_read_only
值可设置所有后续会话的访问模式。现有会话不受影响。
To set the session or next-level 要设置会话或下一级transaction_read_only
value, use the SET
statement. transaction_read_only
值,请使用SET
语句。For most session system variables, these statements are equivalent ways to set the value:对于大多数会话系统变量,这些语句是设置值的等效方法:
SET @@SESSION.var_name
=value
; SET SESSIONvar_name
=value
; SETvar_name
=value
; SET @@var_name
=value
;
As mentioned previously, the transaction access mode has a next-transaction scope, in addition to the global and session scopes. 如前所述,除了全局和会话作用域之外,事务访问模式还有下一个事务作用域。To enable the next-transaction scope to be set, 为了能够设置下一个事务范围,用于分配会话系统变量值的SET
syntax for assigning session system variable values has nonstandard semantics for transaction_read_only
,SET
语法对于transaction_read_only
具有非标准语义,
To set the session access mode, use any of these syntaxes:要设置会话访问模式,请使用以下任意语法:
SET @@SESSION.transaction_read_only =value
; SET SESSION transaction_read_only =value
; SET transaction_read_only =value
;
For each of those syntaxes, these semantics apply:对于这些语法中的每一种,都应用以下语义:
Sets the access mode for all subsequent transactions performed within the session.设置会话中执行的所有后续事务的访问模式。
Permitted within transactions, but does not affect the current ongoing transaction.交易中允许,但不影响当前正在进行的交易。
If executed between transactions, overrides any preceding statement that sets the next-transaction access mode.如果在事务之间执行,则覆盖设置下一个事务访问模式的任何先前语句。
Corresponds to 对应于SET SESSION TRANSACTION {READ WRITE | READ ONLY}
(with the SESSION
keyword).SET SESSION TRANSACTION {READ WRITE | READ ONLY}
(带有SESSION
关键字)。
To set the next-transaction access mode, use this syntax:要设置下一个事务访问模式,请使用以下语法:
SET @@transaction_read_only = value
;
For that syntax, these semantics apply:对于该语法,以下语义适用:
Sets the access mode only for the next single transaction performed within the session.仅为会话中执行的下一个单个事务设置访问模式。
Subsequent transactions revert to the session access mode.后续事务将恢复到会话访问模式。
Not permitted within transactions.交易中不允许。
Corresponds to SET TRANSACTION {READ WRITE | READ ONLY}
(without the SESSION
keyword).
For more information about 有关SET TRANSACTION
and its relationship to the transaction_read_only
system variable, see Section 13.3.7, “SET TRANSACTION Statement”.SET TRANSACTION
及其与transaction_read_only
系统变量的关系的更多信息,请参阅第13.3.7节,“SET TRANSACTION语句”。
unique_checks |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | ON |
If set to 1 (the default), uniqueness checks for secondary indexes in 如果设置为1(默认值),将执行InnoDB
tables are performed. InnoDB
表中二级索引的唯一性检查。If set to 0, storage engines are permitted to assume that duplicate keys are not present in input data. 如果设置为0,则允许存储引擎假定输入数据中不存在重复的密钥。If you know for certain that your data does not contain uniqueness violations, you can set this to 0 to speed up large table imports to 如果您确信您的数据不包含唯一性冲突,则可以将其设置为0,以加快向InnoDB
.InnoDB
导入大表的速度。
Setting this variable to 0 does not require storage engines to ignore duplicate keys. An engine is still permitted to check for them and issue duplicate-key errors if it detects them.将此变量设置为0不需要
存储引擎忽略重复的密钥。发动机仍然可以检查它们,如果检测到它们,则可以发出duplicate-key
错误。
--updatable-views-with-limit[={OFF|ON}] |
|
updatable_views_with_limit |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | 1 |
This variable controls whether updates to a view can be made when the view does not contain all columns of the primary key defined in the underlying table, if the update statement contains a 如果LIMIT
clause. UPDATE
语句包含LIMIT
子句,则此变量控制当视图不包含基础表中定义的主键的所有列时,是否可以对视图进行更新。(Such updates often are generated by GUI tools.) An update is an UPDATE
or DELETE
statement. Primary key here means a PRIMARY KEY
, or a UNIQUE
index in which no column can contain NULL
.
The variable can have two values:
1
or YES
: Issue a warning only (not an error message). This is the default value.
0
or NO
: Prohibit the update.
Introduced | 8.0.13 |
---|---|
use_secondary_engine |
|
Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Enumeration |
Default Value | ON |
Valid Values |
|
For future use.供将来使用。
Whether to execute queries using a secondary engine.是否使用辅助引擎执行查询。
For use with HeatWave. See HeatWave User Guide.
validate_password.
xxx
The validate_password
component implements a set of system variables having names of the form validate_password.
. xxx
These variables affect password testing by that component; see Section 6.4.3.2, “Password Validation Options and Variables”.这些变量会影响该组件的密码测试;参见第6.4.3.2节,“密码验证选项和变量”。
The version number for the server. The value might also include a suffix indicating server build or configuration information. 服务器的版本号。该值还可能包括指示服务器构建或配置信息的后缀。-debug
indicates that the server was built with debugging support enabled.
version_comment |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The CMake configuration program has a COMPILATION_COMMENT_SERVER
option that permits a comment to be specified when building MySQL. This variable contains the value of that comment. (Prior to MySQL 8.0.14, version_comment
is set by the COMPILATION_COMMENT
option.) See Section 2.9.7, “MySQL Source-Configuration Options”.
version_compile_machine |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The type of the server binary.服务器二进制文件的类型。
version_compile_os |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The type of operating system on which MySQL was built.MySQL构建所基于的操作系统的类型。
version_compile_zlib |
|
Global | |
Dynamic | No |
SET_VAR Hint Applies | No |
Type | String |
The version of the compiled-in 在zlib
library.zlib
库中编译的的版本。
--wait-timeout=# |
|
wait_timeout |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | No |
Type | Integer |
Default Value | 28800 |
Minimum Value | 1 |
Maximum Value (Windows) | 2147483 |
Maximum Value (Other) | 31536000 |
The number of seconds the server waits for activity on a noninteractive connection before closing it.服务器在关闭非交互连接之前等待活动的秒数。
On thread startup, the session wait_timeout
value is initialized from the global wait_timeout
value or from the global interactive_timeout
value, depending on the type of client (as defined by the CLIENT_INTERACTIVE
connect option to mysql_real_connect()
). See also interactive_timeout
.
The number of errors, warnings, and notes that resulted from the last statement that generated messages. This variable is read only. 生成消息的最后一条语句所产生的错误、警告和注释的数量。此变量是只读的。See Section 13.7.7.42, “SHOW WARNINGS Statement”.请参阅第13.7.7.42节,“SHOW WARNINGS语句”。
--windowing-use-high-precision[={OFF|ON}] |
|
windowing_use_high_precision |
|
Global, Session | |
Dynamic | Yes |
SET_VAR Hint Applies | Yes |
Type | Boolean |
Default Value | ON |
Whether to compute window operations without loss of precision. See Section 8.2.1.21, “Window Function Optimization”.是否在不损失精度的情况下计算窗口操作。参见第8.2.1.21节,“窗口函数优化”。