This section summarizes what has been added to, deprecated in, and removed from MySQL 8.0. 本节总结了MySQL8.0中添加、弃用和删除的内容。A companion section lists MySQL server options and variables that have been added, deprecated, or removed in MySQL 8.0; see Section 1.4, “Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 8.0”.附带的一节列出了MySQL 8.0中添加、弃用或删除的MySQL服务器选项和变量;请参阅第1.4节,“MySQL8.0中添加、弃用或删除的服务器和状态变量及选项”。
The following features have been added to MySQL 8.0:MySQL 8.0增加了以下功能:
Data dictionary.数据字典。 MySQL now incorporates a transactional data dictionary that stores information about database objects. MySQL现在合并了一个事务数据字典,它存储有关数据库对象的信息。In previous MySQL releases, dictionary data was stored in metadata files and nontransactional tables. 在以前的MySQL版本中,字典数据存储在元数据文件和非事务表中。For more information, see Chapter 14, MySQL Data Dictionary.有关更多信息,请参阅第14章,MySQL数据字典。
Atomic data definition statements (Atomic DDL).原子数据定义语句(Atomic DDL)。 An atomic DDL statement combines the data dictionary updates, storage engine operations, and binary log writes associated with a DDL operation into a single, atomic transaction. 原子DDL语句将数据字典更新、存储引擎操作和与DDL操作相关联的二进制日志写入合并到单个原子事务中。For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.有关更多信息,请参阅第13.1.1节,“原子数据定义语句支持”。
Upgrade procedure.升级过程。 Previously, after installation of a new version of MySQL, the MySQL server automatically upgrades the data dictionary tables at the next startup, after which the DBA is expected to invoke mysql_upgrade manually to upgrade the system tables in the 此前,安装了新版MySQL后,MySQL服务器会在下次启动时自动升级数据字典表,之后DBA会手动调用mysql_upgrade来升级mysql
schema, as well as objects in other schemas such as the sys
schema and user schemas.mysql
架构中的系统表,以及sys
架构和user
架构等其他架构中的对象。
As of MySQL 8.0.16, the server performs the tasks previously handled by mysql_upgrade. 从MySQL 8.0.16开始,服务器执行mysql_upgrade之前处理的任务。After installation of a new MySQL version, the server now automatically performs all necessary upgrade tasks at the next startup and is not dependent on the DBA invoking mysql_upgrade. 安装新的MySQL版本后,服务器现在会在下一次启动时自动执行所有必要的升级任务,并且不依赖于调用mysql_upgrade的DBA。In addition, the server updates the contents of the help tables (something mysql_upgrade did not do). 此外,服务器更新帮助表的内容(mysql_upgrade没有做到这一点)。A new 一个新的--upgrade
server option provides control over how the server performs automatic data dictionary and server upgrade operations. --upgrade
server选项提供了对服务器如何执行自动数据字典和服务器升级操作的控制。For more information, see Section 2.11.3, “What the MySQL Upgrade Process Upgrades”.有关更多信息,请参阅第2.11.3节,“MySQL升级过程升级的内容”。
Security and account management.安全和帐户管理。 These enhancements were added to improve security and enable greater DBA flexibility in account management:添加这些增强功能是为了提高安全性并增强DBA在帐户管理方面的灵活性:
The grant tables in the mysql
system database are now InnoDB
(transactional) tables. mysql
系统数据库中的授权表现在是InnoDB
(事务)表。Previously, these were 以前,这些是MyISAM(非事务)表。MyISAM
(nontransactional) tables. The change of grant table storage engine underlies an accompanying change to the behavior of account-management statements. grant表存储引擎的变化是伴随着帐户管理语句行为变化的基础。Previously, an account-management statement (such as 以前,命名多个用户的帐户管理语句(如CREATE USER
or DROP USER
) that named multiple users could succeed for some users and fail for others. CREATE USER
或DROP USER
)对某些用户可能成功,而对其他用户可能失败。Now, each statement is transactional and either succeeds for all named users or rolls back and has no effect if any error occurs. 现在,每条语句都是事务性的,要么对所有命名用户都成功,要么回滚,如果发生任何错误都没有效果。The statement is written to the binary log if it succeeds, but not if it fails; in that case, rollback occurs and no changes are made. 如果语句成功,则将其写入二进制日志,如果语句失败,则不会写入二进制日志;在这种情况下,将发生回滚,并且不会进行任何更改。For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.有关更多信息,请参阅第13.1.1节,“原子数据定义语句支持”。
A new 一个新的caching_sha2_password
authentication plugin is available. caching_sha2_password
验证插件可用。Like the 与sha256_password
plugin, caching_sha2_password
implements SHA-256 password hashing, but uses caching to address latency issues at connect time. sha256_password
插件一样,caching_sha2_password
实现SHA-256密码散列,但使用缓存来解决连接时的延迟问题。It also supports more transport protocols and does not require linking against OpenSSL for RSA key pair-based password-exchange capabilities. 它还支持更多的传输协议,并且不需要针对基于RSA密钥对的密码交换功能的OpenSSL进行链接。See Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.请参阅第6.4.1.2节,“缓存SHA-2可插入身份验证”。
The caching_sha2_password
and sha256_password
authentication plugins provide more secure password encryption than the mysql_native_password
plugin, and caching_sha2_password
provides better performance than sha256_password
. caching_sha2_password
和sha256_password
身份验证插件提供了比mysql_native_password
插件更安全的密码加密,caching_sha2_password
提供了比sha256_password
更好的性能。Due to these superior security and performance characteristics of 由于caching_sha2_password
, it is now the preferred authentication plugin, and is also the default authentication plugin rather than mysql_native_password
. caching_sha2_password
的这些优越的安全性和性能特点,它现在是首选的身份验证插件,也是默认的身份验证插件,而不是mysql_native_password
。For information about the implications of this change of default plugin 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 now supports roles, which are named collections of privileges. MySQL现在支持角色,这些角色被命名为特权集合。Roles can be created and dropped. 可以创建和删除角色。Roles can have privileges granted to and revoked from them. 角色可以被授予或撤消特权。Roles can be granted to and revoked from user accounts. 可以向用户帐户授予角色,也可以从中撤消角色。The active applicable roles for an account can be selected from among those granted to the account, and can be changed during sessions for that account. 可以从授予帐户的角色中选择帐户的活动适用角色,并且可以在该帐户的会话期间更改这些角色。For more information, see Section 6.2.10, “Using Roles”.有关更多信息,请参阅第6.2.10节,“使用角色”。
MySQL now incorporates the concept of user account categories, with system and regular users distinguished according to whether they have the MySQL现在引入了用户帐户类别的概念,根据系统用户和普通用户是否拥有SYSTEM_USER
privilege. SYSTEM_USER
权限来区分他们。See Section 6.2.11, “Account Categories”.请参阅第6.2.11节,“账户类别”。
Previously, it was not possible to grant privileges that apply globally except for certain schemas. 以前,除了某些架构之外,不可能授予全局应用的特权。This is now possible if the 如果启用了partial_revokes
system variable is enabled. partial_revokes
系统变量,现在就可以这样做了。See Section 6.2.12, “Privilege Restriction Using Partial Revokes”.请参阅第6.2.12节,“使用部分撤销的权限限制”。
The GRANT
statement has an AS
clause that specifies additional information about the privilege context to use for statement execution. user
[WITH ROLE]GRANT
语句有一个AS
子句,该子句指定有关用于语句执行的特权上下文的附加信息。user
[WITH ROLE]This syntax is visible at the SQL level, although its primary purpose is to enable uniform replication across all nodes of grantor privilege restrictions imposed by partial revokes, by causing those restrictions to appear in the binary log. 这种语法在SQL级别是可见的,尽管它的主要目的是通过使那些限制出现在二进制日志中,从而在部分撤销所施加的授予者权限限制的所有节点之间实现一致性复制。See Section 13.7.1.6, “GRANT Statement”.请参阅第13.7.1.6节,“授权声明”。
MySQL now maintains information about password history, enabling restrictions on reuse of previous passwords. MySQL现在维护有关密码历史记录的信息,允许限制重用以前的密码。DBAs can require that new passwords not be selected from previous passwords for some number of password changes or period of time. DBA可以要求在一定数量的密码更改或一段时间内不从以前的密码中选择新密码。It is possible to establish password-reuse policy globally as well as on a per-account basis.可以在全局以及每个帐户的基础上建立密码重用策略。
It is now possible to require that attempts to change account passwords be verified by specifying the current password to be replaced. 现在可以要求通过指定要替换的当前密码来验证更改帐户密码的尝试。This enables DBAs to prevent users from changing password without proving that they know the current password. 这使得dba能够防止用户在不证明他们知道当前密码的情况下更改密码。It is possible to establish password-verification policy globally as well as on a per-account basis.可以在全局以及每个帐户的基础上建立密码验证策略。
Accounts are now permitted to have dual passwords, which enables phased password changes to be performed seamlessly in complex multiple-server systems, without downtime.现在允许帐户使用双密码,这样可以在复杂的多服务器系统中无缝执行分阶段的密码更改,而不必停机。
MySQL now enables administrators to configure user accounts such that too many consecutive login failures due to incorrect passwords cause temporary account locking. MySQL现在允许管理员配置用户帐户,这样由于不正确的密码导致的连续登录失败过多会导致临时帐户锁定。The required number of failures and the lock time are configurable per account.每个帐户都可以配置所需的失败次数和锁定时间。
These new capabilities provide DBAs more complete control over password management. 这些新功能为dba提供了对密码管理的更完整的控制。For more information, see Section 6.2.15, “Password Management”.有关更多信息,请参阅第6.2.15节,“密码管理”。
MySQL now supports FIPS mode, if compiled using OpenSSL, and an OpenSSL library and FIPS Object Module are available at runtime. 如果使用OpenSSL编译,MySQL现在支持FIPS模式,并且在运行时提供了OpenSSL库和FIPS对象模块。FIPS mode imposes conditions on cryptographic operations such as restrictions on acceptable encryption algorithms or requirements for longer key lengths. FIPS模式对加密操作施加条件,例如对可接受的加密算法的限制或对更长密钥长度的要求。See Section 6.8, “FIPS Support”.请参阅第6.8节,“FIPS支持”。
The TLS context the server uses for new connections now is reconfigurable at runtime. 服务器用于新连接的TLS上下文现在可以在运行时重新配置。This capability may be useful, for example, to avoid restarting a MySQL server that has been running so long that its SSL certificate has expired. 此功能可能很有用,例如,可以避免重新启动运行了很长时间的MySQL服务器,使其SSL证书过期。See Server-Side Runtime Configuration and Monitoring for Encrypted Connections.请参阅服务器端运行时配置和加密连接监控。
OpenSSL 1.1.1 supports the TLS v1.3 protocol for encrypted connections, and MySQL 8.0.16 and higher supports TLS v1.3 as well, if both the server and client are compiled using OpenSSL 1.1.1 or higher. OpenSSL 1.1.1支持TLS v1.3协议用于加密连接,如果服务器和客户端都使用OpenSSL 1.1.1或更高版本编译,MySQL 8.0.16和更高版本也支持TLS v1.3。See Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.请参阅第6.3.2节,“加密连接TLS协议和密码”。
MySQL now sets the access control granted to clients on the named pipe to the minimum necessary for successful communication on Windows. MySQL现在将在命名管道上授予客户端的访问控制设置为在Windows上成功通信所需的最小值。Newer MySQL client software can open named pipe connections without any additional configuration. 较新的MySQL客户端软件可以打开命名管道连接,而无需任何其他配置。If older client software cannot be upgraded immediately, the new 如果旧的客户端软件无法立即升级,则可以使用新的named_pipe_full_access_group
system variable can be used to give a Windows group the necessary permissions to open a named pipe connection. named_pipe_full_access_group
系统变量为Windows组提供打开命名管道连接所需的权限。Membership in the full-access group should be restricted and temporary.完全访问组中的成员资格应是有限的和临时的。
Resource management.资源管理。 MySQL now supports creation and management of resource groups, and permits assigning threads running within the server to particular groups so that threads execute according to the resources available to the group. MySQL现在支持创建和管理资源组,并允许将服务器中运行的线程分配给特定的组,以便线程根据组可用的资源执行。Group attributes enable control over its resources, to enable or restrict resource consumption by threads in the group. 组属性启用对其资源的控制,以启用或限制组中线程的资源消耗。DBAs can modify these attributes as appropriate for different workloads. DBA可以根据不同的工作负载修改这些属性。Currently, CPU time is a manageable resource, represented by the concept of “virtual CPU” as a term that includes CPU cores, hyperthreads, hardware threads, and so forth. 目前,CPU时间是一种可管理的资源,由“虚拟CPU”的概念表示,该术语包括CPU核心、超线程、硬件线程等。The server determines at startup how many virtual CPUs are available, and database administrators with appropriate privileges can associate these CPUs with resource groups and assign threads to groups. 服务器在启动时确定有多少虚拟CPU可用,具有适当权限的数据库管理员可以将这些CPU与资源组关联,并为组分配线程。For more information, see Section 5.1.16, “Resource Groups”.有关更多信息,请参阅第5.1.16节,“资源组”。
Table encryption management.表加密管理。 Table encryption can now be managed globally by defining and enforcing encryption defaults. 现在可以通过定义和强制加密默认值来全局管理表加密。The default_table_encryption
variable defines an encryption default for newly created schemas and general tablespace. default_table_encryption
变量为新创建的架构和常规表空间定义加密默认值。The encryption default for a schema can also be defined using the 在创建架构时,还可以使用DEFAULT ENCRYPTION
clause when creating a schema. DEFAULT ENCRYPTION
子句定义架构的加密默认值。By default, a table inherits the encryption of the schema or general tablespace it is created in. 默认情况下,表将继承创建它的架构或常规表空间的加密。Encryption defaults are enforced by enabling the 通过启用table_encryption_privilege_check
variable. table_encryption_privilege_check
变量强制执行加密默认值。The privilege check occurs when creating or altering a schema or general tablespace with an encryption setting 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. default_table_encryption
设置的加密设置创建或更改架构或常规表空间时,或者使用不同于默认架构加密设置的加密设置创建或更改表时,会发生权限检查。The 启用TABLE_ENCRYPTION_ADMIN
privilege permits overriding default encryption settings when table_encryption_privilege_check
is enabled. table_encryption_privilege_check
时,TABLE_ENCRYPTION_ADMIN
权限允许覆盖默认加密设置。For more information, see Defining an Encryption Default for Schemas and General Tablespaces.有关更多信息,请参阅为架构和常规表空间定义加密默认值。
InnoDB enhancements.InnoDB增强功能。 These 添加了以下InnoDB
enhancements were added:InnoDB
增强功能:
The current maximum auto-increment counter value is written to the redo log each time the value changes, and saved to an engine-private system table on each checkpoint. 每次值更改时,当前最大自动增量计数器值都会写入重做日志,并保存到每个检查点的引擎专用系统表中。These changes make the current maximum auto-increment counter value persistent across server restarts. 这些更改使当前最大自动增量计数器值在服务器重新启动时保持不变。Additionally:另外:
A server restart no longer cancels the effect of the 服务器重新启动不再取消AUTO_INCREMENT = N
table option. AUTO_INCREMENT=N
表选项的效果。If you initialize the auto-increment counter to a specific value, or if you alter the auto-increment counter value to a larger value, the new value is persisted across server restarts.如果将自动递增计数器初始化为特定值,或者将自动递增计数器值更改为更大的值,则新值将在服务器重新启动时保留。
A server restart immediately following a ROLLBACK
operation no longer results in the reuse of auto-increment values that were allocated to the rolled-back transaction.ROLLBACK
操作后立即重新启动服务器不再导致重用分配给回滚事务的自动增量值。
If you modify an 如果将AUTO_INCREMENT
column value to a value larger than the current maximum auto-increment value (in an UPDATE
operation, for example), the new value is persisted, and subsequent INSERT
operations allocate auto-increment values starting from the new, larger value.AUTO_INCREMENT
列值修改为大于当前最大自动增量值的值(例如,在UPDATE
操作中),则会保留新值,后续的INSERT
操作会从新的较大值开始分配自动增量值。
For more information, see Section 15.6.1.6, “AUTO_INCREMENT Handling in InnoDB”, and InnoDB AUTO_INCREMENT Counter Initialization.有关更多信息,请参阅第15.6.1.6节,“InnoDB中的自动增量处理”和InnoDB自动增量计数器初始化。
When encountering index tree corruption, 当遇到索引树损坏时,InnoDB
writes a corruption flag to the redo log, which makes the corruption flag crash safe. InnoDB
会在redo日志中写入一个损坏标志,这会使损坏标志安全崩溃。InnoDB
also writes in-memory corruption flag data to an engine-private system table on each checkpoint. InnoDB
还将内存中的损坏标志数据写入每个检查点上的引擎专用系统表。During recovery, 在恢复过程中,InnoDB
reads corruption flags from both locations and merges results before marking in-memory table and index objects as corrupt.InnoDB
从这两个位置读取损坏标志并合并结果,然后将内存中的表和索引对象标记为损坏。
The InnoDB
memcached plugin supports multiple get
operations (fetching multiple key-value pairs in a single memcached query) and range queries. InnoDB
memcached插件支持多个get
操作(在一个memcached查询中获取多个键值对)和范围查询。See Section 15.20.4, “InnoDB memcached Multiple get and Range Query Support”.请参阅第15.20.4节,“InnoDB memcached支持多个get和范围查询”。
A new dynamic variable, 一个新的动态变量innodb_deadlock_detect
, may be used to disable deadlock detection. innodb_deadlock_detect
可用于禁用死锁检测。On high concurrency systems, deadlock detection can cause a slowdown when numerous threads wait for the same lock. 在高并发系统上,当多个线程等待同一个锁时,死锁检测可能会导致速度减慢。At times, it may be more efficient to disable deadlock detection and rely on the 有时,禁用死锁检测并在死锁发生时依赖innodb_lock_wait_timeout
setting for transaction rollback when a deadlock occurs.innodb_lock_wait_timeout
设置事务回滚可能更有效。
The new 新的INFORMATION_SCHEMA.INNODB_CACHED_INDEXES
table reports the number of index pages cached in the InnoDB
buffer pool for each index.INFORMATION_SCHEMA.INNODB_CACHED_INDEXES
表报告每个索引在INNODB
缓冲池中缓存的索引页数。
InnoDB
temporary tables are now created in the shared temporary tablespace, ibtmp1
.InnoDB
临时表现在在共享临时表空间ibtmp1
中创建。
The InnoDB
tablespace encryption feature supports encryption of redo log and undo log data. InnoDB
表空间加密功能支持重做日志和撤消日志数据的加密。See Redo Log Encryption, and Undo Log Encryption.请参见重做日志加密和撤消日志加密。
InnoDB
supports NOWAIT
and SKIP LOCKED
options with SELECT ... FOR SHARE
and SELECT ... FOR UPDATE
locking read statements. InnoDB
支持NOWAIT
和SKIP LOCKED
选项,并带有SELECT ... FOR SHARE
和SELECT ... FOR UPDATE
锁定读取语句。如果请求的行被另一个事务锁定,NOWAIT
causes the statement to return immediately if a requested row is locked by another transaction. NOWAIT
会导致语句立即返回。SKIP LOCKED
removes locked rows from the result set. SKIP LOCKED
从结果集中删除锁定的行。See Locking Read Concurrency with NOWAIT and SKIP LOCKED.请参阅使用NOWAIT和SKIP LOCKED锁定读并发。
SELECT ... FOR SHARE
replaces SELECT ... LOCK IN SHARE MODE
, but LOCK IN SHARE MODE
remains available for backward compatibility. SELECT ... FOR SHARE
代替了SELECT ... LOCK IN SHARE MODE
,但LOCK IN SHARE MODE
仍可用于向后兼容。The statements are equivalent. 这些陈述是等价的。However, 但是,FOR UPDATE
and FOR SHARE
support NOWAIT
, SKIP LOCKED
, and OF
options. tbl_name
FOR UPDATE
和FOR SHARE
支持NOWAIT
、SKIP LOCKED
和OF
选项。tbl_name
See Section 13.2.10, “SELECT Statement”.请参阅第13.2.10节,“选择语句”。
OF
tbl_name
applies locking queries to named tables.将锁定查询应用于命名表。
本地分区就地api支持ADD PARTITION
, DROP PARTITION
, COALESCE PARTITION
, REORGANIZE PARTITION
, and REBUILD PARTITION
ALTER TABLE
options are supported by native partitioning in-place APIs and may be used with ALGORITHM={COPY|INPLACE}
and LOCK
clauses.ALTER TABLE
选项ADD PARTITION
、DROP PARTITION
、COALESCE PARTITION
、REORGANIZE PARTITION
和REBUILD PARTITION
,这些选项可以与ALGORITHM={COPY | INPLACE}
和LOCK
子句一起使用。
DROP PARTITION
with ALGORITHM=INPLACE
deletes data stored in the partition and drops the partition. DROP PARTITION
配合ALGORITHM=INPLACE
删除存储在分区中的数据并删除分区。However, 但是,DROP PARTITION
with ALGORITHM=COPY
or 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. DROP PARTITION
配合ALGORITHM=COPY
或old_alter_table=ON
将重建分区表,并尝试将数据从已删除分区移动到另一个具有兼容分区的PARTITION ... VALUES
定义。Data that cannot be moved to another partition is deleted.无法移动到其他分区的数据将被删除。
The InnoDB
storage engine now uses the MySQL data dictionary rather than its own storage engine-specific data dictionary. InnoDB
存储引擎现在使用MySQL数据字典,而不是自己的存储引擎特定的数据字典。For information about the data dictionary, see Chapter 14, MySQL Data Dictionary.有关数据字典的信息,请参阅第14章,MySQL数据字典。
mysql
system tables and data dictionary tables are now created in a single InnoDB
tablespace file named mysql.ibd
in the MySQL data directory. mysql
系统表和数据字典表现在在mysql数据目录中的一个名为mysql.ibd
的InnoDB
表空间文件中创建。Previously, these tables were created in individual 以前,这些表是在InnoDB
tablespace files in the mysql
database directory.mysql
数据库目录中的单个InnoDB
表空间文件中创建的。
The following undo tablespace changes are introduced in MySQL 8.0:MySQL 8.0中引入了以下撤消表空间更改:
By default, undo logs now reside in two undo tablespaces that are created when the MySQL instance is initialized. Undo logs are no longer created in the system tablespace.默认情况下,undo日志现在驻留在两个undo表空间中,这两个表空间是在MySQL实例初始化时创建的。撤消日志不再在系统表空间中创建。
As of MySQL 8.0.14, additional undo tablespaces can be created in a chosen location at runtime using 从MySQL 8.0.14开始,运行时可以使用CREATE UNDO TABLESPACE
syntax.CREATE UNDO TABLESPACE
语法在所选位置创建其他undo表空间。
CREATE UNDO TABLESPACEtablespace_name
ADD DATAFILE 'file_name
.ibu';
Undo tablespaces created using 使用CREATE UNDO TABLESPACE
syntax can be dropped at runtime using DROP UNDO TABLESPACE
syntax.CREATE UNDO TABLESPACE
语法创建的Undo表空间可以在运行时使用DROP UNDO TABLESPACE
语法删除。
DROP UNDO TABLESPACE tablespace_name
;
ALTER UNDO TABLESPACE
syntax can be used to mark an undo tablespace as active or inactive.ALTER UNDO TABLESPACE
语法可用于将undo表空间标记为活动或不活动。
ALTER UNDO TABLESPACE tablespace_name
SET {ACTIVE|INACTIVE};
A 显示表空间状态的STATE
column that shows the state of a tablespace was added to the INFORMATION_SCHEMA.INNODB_TABLESPACES
table. STATE
列已添加到INFORMATION_SCHEMA.INNODB_TABLESPACES
表中。An undo tablespace must be in an undo表空间必须处于空状态才能被删除。empty
state before it can be dropped.
The 默认情况下启用innodb_undo_log_truncate
variable is enabled by default.innodb_undo_log_truncate
变量。
The innodb_rollback_segments
variable defines the number of rollback segments per undo tablespace. innodb_rollback_segments
变量定义每个undo表空间的回滚段数。Previously, 以前,innodb_rollback_segments
specified the total number of rollback segments for the MySQL instance. innodb_rollback_segments
为MySQL实例指定了回滚段的总数。This change increases the number of rollback segments available for concurrent transactions. 此更改增加了可用于并发事务的回滚段的数量。More rollback segments increases the likelihood that concurrent transactions use separate rollback segments for undo logs, resulting in less resource contention.更多的回滚段增加了并发事务对撤消日志使用单独回滚段的可能性,从而减少了资源争用。
Default values for variables that affect buffer pool preflushing and flushing behavior were modified:已修改影响缓冲池预刷新和刷新行为的变量的默认值:
The innodb_max_dirty_pages_pct_lwm
default value is now 10. innodb_max_dirty_pages_pct_lwm
默认值现在是10。The previous default value of 0 disables buffer pool preflushing. 以前的默认值0禁用缓冲池预冲洗。A value of 10 enables preflushing when the percentage of dirty pages in the buffer pool exceeds 10%. 当缓冲池中脏页的百分比超过10%时,值10将启用预刷新。Enabling preflushing improves performance consistency.启用预冲洗可提高性能一致性。
The innodb_max_dirty_pages_pct
default value was increased from 75 to 90. innodb_max_dirty_pages_pct
默认值从75增加到90。InnoDB
attempts to flush data from the buffer pool so that the percentage of dirty pages does not exceed this value. InnoDB
尝试从缓冲池中刷新数据,以便脏页的百分比不超过此值。The increased default value permits a greater percentage of dirty pages in the buffer pool.增加的默认值允许缓冲池中脏页的百分比增加。
The default 默认的innodb_autoinc_lock_mode
setting is now 2 (interleaved). innodb_autoinc_lock_mode
设置现在是2(交错)。Interleaved lock mode permits the execution of multi-row inserts in parallel, which improves concurrency and scalability. 交错锁模式允许并行执行多行插入,提高了并发性和可扩展性。The new 新的innodb_autoinc_lock_mode默认设置反映了MySQL 5.7中默认复制类型从基于语句的复制到基于行的复制的变化。innodb_autoinc_lock_mode
default setting reflects the change from statement-based replication to row based replication as the default replication type in MySQL 5.7. Statement-based replication requires the consecutive auto-increment lock mode (the previous default) to ensure that auto-increment values are assigned in a predictable and repeatable order for a given sequence of SQL statements, whereas row-based replication is not sensitive to the execution order of SQL statements. 基于语句的复制需要连续自动增量锁定模式(以前的默认模式),以确保以可预测和可重复的顺序为给定的SQL语句序列分配自动增量值,而基于行的复制对SQL语句的执行顺序不敏感。For more information, see InnoDB AUTO_INCREMENT Lock Modes.有关更多信息,请参阅InnoDB自动增量锁定模式。
For systems that use statement-based replication, the new 对于使用基于语句的复制的系统,新的innodb_autoinc_lock_mode
default setting may break applications that depend on sequential auto-increment values. innodb_autoinc_lock_mode
默认设置可能会中断依赖于顺序自动增量值的应用程序。To restore the previous default, set 要恢复以前的默认值,请将innodb_autoinc_lock_mode
to 1.innodb_autoinc_lock_mode
设置为1。
Renaming a general tablespace is supported by ALTER TABLESPACE ... RENAME TO
syntax.ALTER TABLESPACE ... RENAME TO
语法支持重命名常规表空间。
The new 默认情况下禁用的新innodb_dedicated_server
variable, which is disabled by default, can be used to have InnoDB
automatically configure the following options according to the amount of memory detected on the server:innodb_dedicated_server
变量可用于让InnoDB
根据在服务器上检测到的内存量自动配置以下选项:
This option is intended for MySQL server instances that run on a dedicated server. 此选项适用于在专用服务器上运行的MySQL服务器实例。For more information, see Section 15.8.12, “Enabling Automatic Configuration for a Dedicated MySQL Server”.有关更多信息,请参阅第15.8.12节,“启用专用MySQL服务器的自动配置”。
The new 新的INFORMATION_SCHEMA.INNODB_TABLESPACES_BRIEF
view provides space, name, path, flag, and space type data for InnoDB
tablespaces.INFORMATION_SCHEMA.INNODB_TABLESPACES_BRIEF
视图为InnoDB
表空间提供空间、名称、路径、标志和空间类型数据。
The zlib library version bundled with MySQL was raised from version 1.2.3 to version 1.2.11. 与MySQL捆绑的zlib库版本从版本1.2.3提升到版本1.2.11。MySQL implements compression with the help of the zlib library.MySQL在zlib库的帮助下实现压缩。
If you use InnoDB
compressed tables, see Section 2.11.4, “Changes in MySQL 8.0” for related upgrade implications.
Serialized dictionary information (SDI) is present in all 序列化字典信息(SDI)存在于所有InnoDB
tablespace files except for global temporary tablespace and undo tablespace files. InnoDB
表空间文件中,但全局临时表空间和撤消表空间文件除外。SDI is serialized metadata for table and tablespace objects. SDI是表和表空间对象的序列化元数据。The presence of SDI data provides metadata redundancy. SDI数据的存在提供了元数据冗余。For example, dictionary object metadata may be extracted from tablespace files if the data dictionary becomes unavailable. 例如,如果数据字典变得不可用,则可以从表空间文件中提取字典对象元数据。SDI extraction is performed using the ibd2sdi tool. 使用ibd2sdi
工具执行SDI提取。SDI data is stored in SDI数据以JSON
format.JSON
格式存储。
The inclusion of SDI data in tablespace files increases tablespace file size. 在表空间文件中包含SDI数据会增加表空间文件的大小。An SDI record requires a single index page, which is 16KB in size by default. SDI记录需要单个索引页,默认情况下索引页的大小为16KB。However, SDI data is compressed when it is stored to reduce the storage footprint.但是,存储SDI数据时会对其进行压缩,以减少存储占用空间。
The InnoDB
storage engine now supports atomic DDL, which ensures that DDL operations are either fully committed or rolled back, even if the server halts during the operation. InnoDB
存储引擎现在支持原子DDL,它确保DDL操作要么完全提交,要么回滚,即使服务器在操作期间停止。For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.有关更多信息,请参阅第13.1.1节,“原子数据定义语句支持”。
Tablespace files can be moved or restored to a new location while the server is offline using the 当服务器脱机时,可以使用innodb_directories
option. innodb_directories
选项将表空间文件移动或还原到新位置。For more information, see Section 15.6.3.6, “Moving Tablespace Files While the Server is Offline”.有关详细信息,请参阅第15.6.3.6节,“在服务器脱机时移动表空间文件”。
The following redo logging optimizations were implemented:实现了以下重做日志优化:
User threads can now write concurrently to the log buffer without synchronizing writes.用户线程现在可以并发地写入日志缓冲区,而无需同步写入。
User threads can now add dirty pages to the flush list in a relaxed order.用户线程现在可以轻松地将脏页添加到刷新列表中。
A dedicated log thread is now responsible for writing the log buffer to the system buffers, flushing system buffers to disk, notifying user threads about written and flushed redo, maintaining the lag required for the relaxed flush list order, and write checkpoints.现在,一个专用的日志线程负责将日志缓冲区写入系统缓冲区、将系统缓冲区刷新到磁盘、向用户线程通知已写入和已刷新的重做、维护松弛的刷新列表顺序所需的延迟以及写入检查点。
System variables were added for configuring the use of spin delay by user threads waiting for flushed redo:添加了系统变量,用于配置等待刷新重做的用户线程使用自旋延迟:
innodb_log_wait_for_flush_spin_hwm
: Defines the maximum average log flush time beyond which user threads no longer spin while waiting for flushed redo.:定义等待刷新重做时用户线程不再旋转的最大平均日志刷新时间。
innodb_log_spin_cpu_abs_lwm
: Defines the minimum amount of CPU usage below which user threads no longer spin while waiting for flushed redo.:定义在等待刷新重做时用户线程不再旋转的最小CPU使用量。
innodb_log_spin_cpu_pct_hwm
: Defines the maximum amount of CPU usage above which user threads no longer spin while waiting for flushed redo.:定义在等待刷新重做时用户线程不再旋转的最大CPU使用量。
The innodb_log_buffer_size
variable is now dynamic, which permits resizing of the log buffer while the server is running.innodb_log_buffer_size
变量现在是动态的,它允许在服务器运行时调整日志缓冲区的大小。
For more information, see Section 8.5.4, “Optimizing InnoDB Redo Logging”.有关更多信息,请参阅第8.5.4节,“优化InnoDB重做日志记录”。
As of MySQL 8.0.12, undo logging is supported for small updates to large object (LOB) data, which improves performance of LOB updates that are 100 bytes in size or less. 从MySQL 8.0.12开始,对大对象(LOB)数据的小更新支持undo logging,这提高了大小小于等于100字节的LOB更新的性能。Previously, LOB updates were a minimum of one LOB page in size, which is less than optimal for updates that might only modify a few bytes. 以前,LOB更新的大小至少为一个LOB页,对于只修改几个字节的更新来说,这不是最佳的。This enhancement builds upon support added in MySQL 8.0.4 for partial update of LOB data.此增强基于MySQL 8.0.4中添加的对LOB数据部分更新的支持。
As of MySQL 8.0.12, 从MySQL 8.0.12开始,以下ALGORITHM=INSTANT
is supported for the following ALTER TABLE
operations:ALTER TABLE
操作支持ALGORITHM=INSTANT
:
Adding a column. 添加列。This feature is also referred to as “Instant 此功能也称为“即时添加列”。ADD COLUMN
”. Limitations apply. 限制适用。See Section 15.12.1, “Online DDL Operations”.请参阅第15.12.1节,“在线DDL操作”。
Adding or dropping a virtual column.添加或删除虚拟列。
Adding or dropping a column default value.添加或删除列默认值。
Modifying the definition of an 修改ENUM
or SET
column.ENUM
列或SET
列的定义。
Changing the index type.更改索引类型。
Renaming a table.重命名表。
Operations that support 支持ALGORITHM=INSTANT
only modify metadata in the data dictionary. ALGORITHM=INSTANT
的操作只修改数据字典中的元数据。No metadata locks are taken on the table, and table data is unaffected, making the operations instantaneous. 表上没有元数据锁,并且表数据不受影响,这使得操作是瞬时的。If not specified explicitly, 如果没有明确指定,默认情况下,支持算法的操作将使用ALGORITHM=INSTANT
is used by default by operations that support it. ALGORITHM=INSTANT
。If 如果指定了ALGORITHM=INSTANT
is specified but not supported, the operation fails immediately with an error.ALGORITHM=INSTANT
但不支持,则操作会立即失败并出现错误。
For more information about operations that support 有关支持ALGORITHM=INSTANT
, see Section 15.12.1, “Online DDL Operations”.ALGORITHM=INSTANT
的操作的更多信息,请参阅第15.12.1节,“在线DDL操作”。
As of MySQL 8.0.13, the 从MySQL 8.0.13开始,TempTable
storage engine supports storage of binary large object (BLOB) type columns. TempTable
存储引擎支持二进制大对象(BLOB)类型列的存储。This enhancement improves performance for queries that use temporary tables containing BLOB data. 此增强功能提高了使用包含BLOB数据的临时表的查询的性能。Previously, temporary tables that contained BLOB data were stored in the on-disk storage engine defined by 以前,包含BLOB数据的临时表存储在由internal_tmp_disk_storage_engine
. internal_tmp_disk_storage_engine
定义的磁盘存储引擎中。For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.有关更多信息,请参阅第8.4.4节,“MySQL中的内部临时表使用”。
As of MySQL 8.0.13, the 从MySQL 8.0.13开始,InnoDB
data-at-rest encryption feature supports general tablespaces. InnoDB
静态数据加密特性支持通用表空间。Previously, only file-per-table tablespaces could be encrypted. 以前,只能对每个表的文件表空间进行加密。To support encryption of general tablespaces, 为了支持一般表空间的加密,CREATE TABLESPACE
and ALTER TABLESPACE
syntax was extended to include an ENCRYPTION
clause.CREATE TABLESPACE
和ALTER TABLESPACE
语法被扩展为包含一个ENCRYPTION
子句。
The INFORMATION_SCHEMA.INNODB_TABLESPACES
table now includes an ENCRYPTION
column that indicates whether or not a tablespace is encrypted.INFORMATION_SCHEMA.INNODB_TABLESPACES
表现在包含一个ENCRYPTION列,指示表空间是否加密。
The 添加了stage/innodb/alter tablespace (encryption)
Performance Schema stage instrument was added to permit monitoring of general tablespace encryption operations.stage/innodb/alter tablespace(encryption)
性能架构阶段工具,以允许监视常规表空间加密操作。
Disabling the 禁用innodb_buffer_pool_in_core_file
variable reduces the size of core files by excluding InnoDB
buffer pool pages. innodb_buffer_pool_in_core_file
变量可以通过排除InnoDB
缓冲池页面来减小核心文件的大小。To use this variable, the 要使用此变量,必须启用core_file
variable must be enabled and the operating system must support the MADV_DONTDUMP
non-POSIX extension to madvise()
, which is supported in Linux 3.4 and later. core_file
变量,并且操作系统必须支持madvise()
的MADV_DONTDUMP
non-POSIX扩展,这在Linux 3.4和更高版本中是受支持的。For more information, see Section 15.8.3.7, “Excluding Buffer Pool Pages from Core Files”.有关更多信息,请参阅第15.8.3.7节,“从核心文件中排除缓冲池页”。
As of MySQL 8.0.13, user-created temporary tables and internal temporary tables created by the optimizer are stored in session temporary tablespaces that are allocated to a session from a pool of temporary tablespaces. 从MySQL 8.0.13开始,用户创建的临时表和优化器创建的内部临时表存储在会话临时表空间中,这些临时表空间是从临时表空间池分配给会话的。When a session disconnects, its temporary tablespaces are truncated and released back to the pool. 当会话断开连接时,它的临时表空间将被截断并释放回池中。In previous releases, temporary tables were created in the global temporary tablespace (在以前的版本中,临时表是在全局临时表空间(ibtmp1
), which did not return disk space to the operating system after temporary tables were dropped.ibtmp1
)中创建的,在删除临时表之后,全局临时表空间不会将磁盘空间返回给操作系统。
The innodb_temp_tablespaces_dir
variable defines the location where session temporary tablespaces are created. innodb_temp_tablespaces_dir
变量定义创建会话临时表空间的位置。The default location is the 默认位置是数据目录中的#innodb_temp
directory in the data directory.#innodbŠu temp
目录。
The INNODB_SESSION_TEMP_TABLESPACES
table provides metadata about session temporary tablespaces.INNODB_SESSION_TEMP_TABLESPACES
表提供有关会话临时表空间的元数据。
The global temporary tablespace (全局临时表空间(ibtmp1
) now stores rollback segments for changes made to user-created temporary tables.ibtmp1
)现在存储对用户创建的临时表所做更改的回滚段。
As of MySQL 8.0.14, 从MySQL8.0.14开始,InnoDB
supports parallel clustered index reads, which can improve CHECK TABLE
performance. InnoDB
支持并行聚集索引读取,这可以提高CHECK TABLE
的性能。This feature does not apply to secondary index scans. 此功能不适用于辅助索引扫描。The innodb_parallel_read_threads
session variable must be set to a value greater than 1 for parallel clustered index reads to occur. innodb_parallel_read_threads
会话变量必须设置为大于1的值,才能进行并行聚集索引读取。The default value is 4. 默认值为4。The actual number of threads used to perform a parallel clustered index read is determined by the 用于执行并行聚集索引读取的实际线程数由innodb_parallel_read_threads
setting or the number of index subtrees to scan, whichever is smaller.innodb_parallel_read_threads
设置或要扫描的索引子树数决定,以较小者为准。
As of 8.0.14, when the 从8.0.14开始,当启用innodb_dedicated_server
variable is enabled, the size and number of log files are configured according to the automatically configured buffer pool size. innodb_dedicated_server
变量时,将根据自动配置的缓冲池大小配置日志文件的大小和数量。Previously, log file size was configured according to the amount of memory detected on the server, and the number of log files was not configured automatically.以前,日志文件大小是根据服务器上检测到的内存量配置的,日志文件的数量不是自动配置的。
As of 8.0.14, the 从8.0.14开始,ADD DATAFILE
clause of the CREATE TABLESPACE
statement is optional, which permits users without the FILE
privilege to create tablespaces. CREATE TABLESPACE
语句的ADD DATAFILE
子句是可选的,它允许没有FILE
权限的用户创建表空间。A 在没有CREATE TABLESPACE
statement executed without an ADD DATAFILE
clause implicitly creates a tablespace data file with a unique file name.ADD DATAFILE
子句的情况下执行的CREATE TABLESPACE
语句会隐式地创建具有唯一文件名的表空间数据文件。
By default, when the amount of memory occupied by the TempTable storage engine exceeds the memory limit defined by the 默认情况下,当试探性存储引擎占用的内存量超过temptable_max_ram
variable, the TempTable storage engine begins allocating memory-mapped temporary files from disk. temptable_max_ram
变量定义的内存限制时,试探性存储引擎开始从磁盘分配内存映射的临时文件。As of MySQL 8.0.16, this behavior is controlled by the 从MySQL8.0.16开始,这个行为由temptable_use_mmap
variable. temptable_use_mmap
变量控制。Disabling 禁用temptable_use_mmap
causes the TempTable storage engine to use InnoDB
on-disk internal temporary tables instead of memory-mapped files as its overflow mechanism. temptable_use_mmap
会导致试探性存储引擎使用InnoDB
on-disk内部临时表,而不是内存映射文件作为其溢出机制。For more information, see Internal Temporary Table Storage Engine.有关详细信息,请参阅内部临时表存储引擎。
As of MySQL 8.0.16, the 从MySQL 8.0.16开始,InnoDB
data-at-rest encryption feature supports encryption of the mysql
system tablespace. InnoDB
静态数据加密功能支持mysql
系统表空间的加密。The mysql
system tablespace contains the mysql
system database and the MySQL data dictionary tables. mysql
系统表空间包含mysql
系统数据库和MySQL数据字典表。For more information, see Section 15.13, “InnoDB Data-at-Rest Encryption”.有关更多信息,请参阅第15.13节,“InnoDB静态数据加密”。
The 在MySQL 8.0.16中引入的innodb_spin_wait_pause_multiplier
variable, introduced in MySQL 8.0.16, provides greater control over the duration of spin-lock polling delays that occur when a thread waits to acquire a mutex or rw-lock. innodb_spin_wait_pause_multiplier
变量可以更好地控制线程等待获取互斥锁或rw锁时发生的自旋锁轮询延迟的持续时间。Delays can be tuned more finely to account for differences in PAUSE instruction duration on different processor architectures. 可以对延迟进行更精细的调整,以考虑不同处理器体系结构上暂停指令持续时间的差异。For more information, see Section 15.8.8, “Configuring Spin Lock Polling”.有关更多信息,请参阅第15.8.8节,“配置自旋锁轮询”。
在MySQL 8.0.17中,通过更好地利用读取线程、减少并行扫描期间发生的预取活动的读取线程I/O以及支持分区的并行扫描,大型数据集的InnoDB
parallel read thread performance for large data sets was improved in MySQL 8.0.17 through better utilization of read threads, through a reduction in read thread I/O for prefetch activity that occurs during parallel scans, and through support for parallel scanning of partitions.InnoDB
并行读取线程性能得到了提高。
The parallel read thread feature is controlled by the 并行读取线程功能由innodb_parallel_read_threads
variable. innodb_parallel_read_threads
变量控制。The maximum setting is now 256, which is the total number of threads for all client connections. 最大设置现在是256,这是所有客户端连接的线程总数。If the thread limit is reached, connections fall back to using a single thread.如果达到线程限制,连接将返回到使用单个线程。
The MySQL 8.0.18中引入的innodb_idle_flush_pct
variable, introduced in MySQL 8.0.18, permits placing a limit on page flushing during idle periods, which can help extend the life of solid state storage devices. innodb_idle_flush_pct
变量允许在空闲期间限制页面刷新,这有助于延长固态存储设备的寿命。See Limiting Buffer Flushing During Idle Periods.请参阅在空闲期间限制缓冲区刷新。
Efficient sampling of 从MySQL8.0.19开始,支持对InnoDB
data for the purpose of generating histogram statistics is supported as of MySQL 8.0.19. InnoDB
数据进行有效采样,以生成直方图统计信息。See Histogram Statistics Analysis.请参阅直方图统计分析。
As of MySQL 8.0.20, the doublewrite buffer storage area resides in doublewrite files. 从MySQL 8.0.20开始,doublewrite缓冲区存储区驻留在doublewrite文件中。In previous releases, the storage area resided in the system tablespace. 在以前的版本中,存储区域位于系统表空间中。Moving the storage area out of the system tablespace reduces write latency, increases throughput, and provides flexibility with respect to placement of doublewrite buffer pages. 将存储区域移出系统表空间可减少写入延迟,提高吞吐量,并在放置双写缓冲页方面提供灵活性。The following system variables were introduced for advanced doublewrite buffer configuration:为高级双写缓冲区配置引入了以下系统变量:
Defines the doublewrite buffer file directory.定义doublewrite缓冲区文件目录。
Defines the number of doublewrite files.定义doublewrite文件的数目。
Defines the maximum number of doublewrite pages per thread for a batch write.定义批写入时每个线程的最大双写页数。
Defines the number of doublewrite pages to write in a batch.定义要在批处理中写入的双写页数。
For more information, see Section 15.6.4, “Doublewrite Buffer”.有关更多信息,请参阅第15.6.4节,“双写缓冲区”。
The Contention-Aware Transaction Scheduling (CATS) algorithm, which prioritizes transactions that are waiting for locks, was improved in MySQL 8.0.20. 在MySQL 8.0.20中改进了争用感知事务调度(CATS)算法,该算法对等待锁的事务进行优先级排序。Transaction scheduling weight computation is now performed a separate thread entirely, which improves computation performance and accuracy.事务调度权重计算现在完全由单独的线程执行,这提高了计算性能和准确性。
The First In First Out (FIFO) algorithm, which had also been used for transaction scheduling, was removed. 先进先出(FIFO)算法也被用于事务调度,被删除。The FIFO algorithm was rendered redundant by CATS algorithm enhancements. FIFO算法通过CATS算法增强而变得冗余。Transaction scheduling previously performed by the FIFO algorithm is now performed by the CATS algorithm.以前由FIFO算法执行的事务调度现在由CATS算法执行。
A 在TRX_SCHEDULE_WEIGHT
column was added to the INFORMATION_SCHEMA.INNODB_TRX
table, which permits querying transaction scheduling weights assigned by the CATS algorithm.INFORMATION_SCHEMA.INNODB_TRX
表中添加了一个TRX_SCHEDULE_WEIGHT
列,允许查询由CATS算法分配的事务调度权重。
The following 为监视代码级事务调度事件,添加了以下INNODB_METRICS
counters were added for monitoring code-level transaction scheduling events:INNODB_METRICS
计数器:
lock_rec_release_attempts
The number of attempts to release record locks.尝试释放记录锁的次数。
lock_rec_grant_attempts
The number of attempts to grant record locks.尝试授予记录锁的次数。
lock_schedule_refreshes
The number of times the wait-for graph was analyzed to update transaction schedule weights.分析等待图以更新事务调度权重的次数。
For more information, see Section 15.7.6, “Transaction Scheduling”.有关更多信息,请参阅第15.7.6节,“事务调度”。
As of MySQL 8.0.21, to improve concurrency for operations that require access to lock queues for table and row resources, the lock system mutex (从MySQL8.0.21开始,为了提高需要访问表和行资源的锁队列的操作的并发性,锁系统mutex(lock_sys->mutex
) was replaced in by sharded latches, and lock queues were grouped into table and page lock queue shards, with each shard protected by a dedicated mutex. lock_sys->mutex
)被分片锁存器替换,锁队列被分组到表锁队列和页锁定队列分片中,每个分片由一个专用的mutex保护。Previously, the single lock system mutex protected all lock queues, which was a point of contention on high-concurrency systems. 以前,单锁系统互斥锁保护所有锁队列,这是高并发系统上的争用点。The new sharded implementation permits more granular access to lock queues.新的分片实现允许对锁队列进行更细粒度的访问。
The lock system mutex (锁定系统互斥锁(lock_sys->mutex
) was replaced by the following sharded latches:lock_sys->mutex
)被以下分片闩锁替换:
A global latch (全局闩锁(lock_sys->latches.global_latch
) consisting of 64 read-write lock objects (rw_lock_t
). lock_sys->latches.global_latch
)由64个读写锁对象(rw_lock_t
)组成。Access to an individual lock queue requires a shared global latch and a latch on the lock queue shard. 对单个锁队列的访问需要共享全局闩锁和锁队列碎片上的闩锁。Operations that require access to all lock queues take an exclusive global latch, which latches all table and page lock queue shards.需要访问所有锁队列的操作采用独占全局锁存器,该锁存器锁存所有表和页锁队列碎片。
Table shard latches (表碎片闩锁(lock_sys->latches.table_shards.mutexes
), implemented as an array of 512 mutexes, with each mutex dedicated to one of 512 table lock queue shards.lock_sys->latches.table_shards.mutexes
),实现为512个mutex的数组,每个mutex专用于512个表锁队列碎片中的一个。
Page shard latches (页碎片闩锁(lock_sys->latches.page_shards.mutexes
), implemented as an array of 512 mutexes, with each mutex dedicated to one of 512 page lock queue shards.lock_sys->latches.page_shards.mutexes
),实现为512个mutex的数组,每个mutex专用于512个页锁队列碎片中的一个。
The Performance Schema 用于监视单锁系统互斥锁的性能模式wait/synch/mutex/innodb/lock_mutex
instrument for monitoring the single lock system mutex was replaced by instruments for monitoring the new global, table shard, and page shard latches:wait/synch/mutex/innodb/lock_mutex
工具已被用于监视新的全局、表碎片和页碎片锁存的工具所取代:
wait/synch/sxlock/innodb/lock_sys_global_rw_lock
wait/synch/mutex/innodb/lock_sys_table_mutex
wait/synch/mutex/innodb/lock_sys_page_mutex
As of MySQL 8.0.21, table and table partition data files created outside of the data directory using the 从MySQL 8.0.21开始,使用DATA DIRECTORY
clause are restricted to directories known to InnoDB
. DATA DIRECTORY
子句在数据目录之外创建的表和表分区数据文件被限制在InnoDB已知的目录中。This change permits database administrators to control where tablespace data files are created and ensures that the data files can be found during recovery.此更改允许数据库管理员控制表空间数据文件的创建位置,并确保在恢复期间可以找到数据文件。
General and file-per-table tablespaces data files (不能再在undo表空间目录(.ibd
files) can no longer be created in the undo tablespace directory (innodb_undo_directory
) unless that directly is known to InnoDB
.innodb_undo_directory
)中创建通用数据文件和每个表一个文件的表空间数据文件(.ibd文件),除非InnoDB
直接知道。
Known directories are those defined by the 已知目录是由datadir
, innodb_data_home_dir
, and innodb_directories
variables.datadir
、innodb_data_home_dir
和innodb_directories
变量定义的目录。
Truncating an 截断驻留在每个表空间的文件中的InnoDB
table that resides in a file-per-table tablespace drops the existing tablespace and creates a new one. InnoDB
表会删除现有的表空间并创建一个新的表空间。As of MySQL 8.0.21, 从MySQL 8.0.21开始,InnoDB
creates the new tablespace in the default location and writes a warning to the error log if the current tablespace directory is unknown. InnoDB
在默认位置创建新的表空间,如果当前表空间目录未知,则向错误日志写入警告。To have 要让TRUNCATE TABLE
create the tablespace in its current location, add the directory to the innodb_directories
setting before running TRUNCATE TABLE
.TRUNCATE TABLE
在其当前位置创建表空间,请在运行TRUNCATE TABLE
之前将目录添加到innodb_directories
设置中。
As of MySQL 8.0.21, redo logging can be enabled and disabled using 从MySQL 8.0.21开始,可以使用ALTER INSTANCE {ENABLE|DISABLE} INNODB REDO_LOG
syntax. ALTER INSTANCE {ENABLE|DISABLE} INNODB REDO_LOG
语法启用和禁用redo日志。This functionality is intended for loading data into a new MySQL instance. 此功能用于将数据加载到新的MySQL实例中。Disabling redo logging helps speed up data loading by avoiding redo log writes.禁用重做日志有助于通过避免重做日志写入来加速数据加载。
The new 新的INNODB_REDO_LOG_ENABLE
privilege permits enabling and disabling redo logging.INNODB_REDO_LOG_ENABLE
权限允许启用和禁用redo日志。
The new 新的Innodb_redo_log_enabled
status variable permits monitoring redo logging status.Innodb_redo_log_enabled
状态变量允许监视redo日志状态。
See Disabling Redo Logging.请参见禁用重做日志记录。
At startup, 在启动时,InnoDB
validates the paths of known tablespace files against tablespace file paths stored in the data dictionary in case tablespace files have been moved to a different location. InnoDB
根据数据字典中存储的表空间文件路径验证已知表空间文件的路径,以防表空间文件被移动到其他位置。The new MySQL 8.0.21中引入的新innodb_validate_tablespace_paths
variable, introduced in MySQL 8.0.21, permits disabling tablespace path validation. innodb_validate_tablespace_paths
变量允许禁用表空间路径验证。This feature is intended for environments where tablespaces files are not moved. 此功能适用于不移动表空间文件的环境。Disabling tablespace path validation improves startup time on systems with a large number of tablespace files.禁用表空间路径验证可以缩短具有大量表空间文件的系统的启动时间。
For more information, see Section 15.6.3.7, “Disabling Tablespace Path Validation”.有关更多信息,请参阅第15.6.3.7节,“禁用表空间路径验证”。
As of MySQL 8.0.21, on storage engines that support atomic DDL, the 从MySQL8.0.21开始,在支持原子DDL的存储引擎上,当使用基于行的复制时,CREATE TABLE ... SELECT
statement is logged as one transaction in the binary log when row-based replication is in use. CREATE TABLE ... SELECT
语句作为一个事务记录在二进制日志中。Previously, it was logged as two transactions, one to create the table, and the other to insert data. 以前,它被记录为两个事务,一个用于创建表,另一个用于插入数据。With this change, 使用此更改,CREATE TABLE ... SELECT
statements are now safe for row-based replication and permitted for use with GTID-based replication. CREATE TABLE ... SELECT
语句现在对于基于行的复制是安全的,并且允许与基于GTID的复制一起使用。For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.有关更多信息,请参阅第13.1.1节,“原子数据定义语句支持”。
Truncating an undo tablespace on a busy system could affect performance due to associated flushing operations that remove old undo tablespace pages from the buffer pool and flush the initial pages of the new undo tablespace to disk. 在繁忙系统上截断撤消表空间可能会影响性能,因为相关的刷新操作会从缓冲池中删除旧的撤消表空间页,并将新撤消表空间的初始页刷新到磁盘。To address this issue, the flushing operations are removed as of MySQL 8.0.21.为了解决这个问题,从MySQL8.0.21开始就删除了刷新操作。
Old undo tablespace pages are released passively as they become least recently used, or are removed at the next full checkpoint. 旧的撤消表空间页在最近最少使用时被被动释放,或者在下一个完整检查点被删除。The initial pages of the new undo tablespace are now redo logged instead of flushed to disk during the truncate operation, which also improves durability of the undo tablespace truncate operation.在truncate操作期间,新undo表空间的初始页现在被重做日志记录,而不是刷新到磁盘,这也提高了undo表空间截断操作的持久性。
To prevent potential issues caused by an excessive number of undo tablespace truncate operations, truncate operations on the same undo tablespace between checkpoints are now limited to 64. 为了防止由于撤消表空间截断操作过多而导致的潜在问题,检查点之间相同撤消表空间上的截断操作现在限制为64个。If the limit is exceeded, an undo tablespace can still be made inactive, but it is not truncated until after the next checkpoint.如果超出限制,撤消表空间仍然可以处于非活动状态,但直到下一个检查点之后才被截断。
已删除与失效的撤消截断刷新操作关联的INNODB_METRICS
counters associated with defunct undo truncate flushing operations were removed. INNODB_METRICS
计数器。Removed counters include: 删除的计数器包括:undo_truncate_sweep_count
, undo_truncate_sweep_usec
, undo_truncate_flush_count
, and undo_truncate_flush_usec
.undo_truncate_sweep_count
、undo_truncate_sweep_usec
、undo_truncate_flush_count
和undo_truncate_flush_usec
。
See Section 15.6.3.4, “Undo Tablespaces”.请参阅第15.6.3.4节,“撤消表空间”。
As of MySQL 8.0.22, the new 从MySQL 8.0.22开始,新的innodb_extend_and_initialize
variable permits configuring how InnoDB
allocates space to file-per-table and general tablespaces on Linux. innodb_extend_and_initialize
变量允许配置InnoDB
如何为Linux上的每个表和常规表空间分配空间。By default, when an operation requires additional space in a tablespace, 默认情况下,当操作需要表空间中的额外空间时,InnoDB
allocates pages to the tablespace and physically writes NULLs to those pages. InnoDB
会将页分配给表空间,并物理地将空值写入这些页。This behavior affects performance if new pages are allocated frequently. 如果频繁分配新页面,此行为会影响性能。You can disable 您可以在Linux系统上禁用innodb_extend_and_initialize
on Linux systems to avoid physically writing NULLs to newly allocated tablespace pages. innodb_extend_and_initialize
,以避免在物理上向新分配的表空间页写入空值。When 当innodb_extend_and_initialize
is disabled, space is allocated using posix_fallocate()
calls, which reserve space without physically writing NULLs.innodb_extend_and_initialize
被禁用时,将使用posix_fallocate()
调用来分配空间,该调用会保留空间,而不会实际写入空值。
A posix_fallocate()
operation is not atomic, which makes it possible for a failure to occur between allocating space to a tablespace file and updating the file metadata. posix_fallocate()
操作不是原子操作,这使得在为表空间文件分配空间和更新文件元数据之间可能发生故障。Such a failure can leave newly allocated pages in an uninitialized state, resulting in a failure when 这样的失败会使新分配的页面处于未初始化状态,导致InnoDB
attempts to access those pages. InnoDB
尝试访问这些页面时失败。To prevent this scenario, 为了防止出现这种情况,InnoDB
writes a redo log record before allocating a new tablespace page. InnoDB
在分配新的表空间页之前会写一个redo log记录。If a page allocation operation is interrupted, the operation is replayed from the redo log record during recovery.如果页面分配操作被中断,则在恢复期间将从重做日志记录中重放该操作。
As of MySQL 8.0.23, 从MySQL 8.0.23开始,InnoDB
supports encryption of doublewrite file pages belonging to encrypted tablespaces. InnoDB
支持加密属于加密表空间的双写文件页。The pages are encrypted using the encryption key of the associated tablespace. 使用相关表空间的加密密钥对页进行加密。For more information, see Section 15.13, “InnoDB Data-at-Rest Encryption”.有关更多信息,请参阅第15.13节,“InnoDB静态数据加密”。
The 在MySQL 8.0.23中引入的temptable_max_mmap
variable, introduced in MySQL 8.0.23, defines the maximum amount of memory the TempTable storage engine is permitted to allocate from memory-mapped (MMAP) files before it starts storing internal temporary table data on disk. temptable_max_mmap
变量定义了在开始在磁盘上存储内部临时表数据之前,允许试探性存储引擎从内存映射(MMAP)文件分配的最大内存量。A setting of 0 disables allocation from MMAP files. 设置为0将禁用MMAP文件的分配。For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.有关更多信息,请参阅第8.4.4节,“MySQL中的内部临时表使用”。
The MySQL 8.0.23中引入了AUTOEXTEND_SIZE
option, introduced in MySQL 8.0.23, defines the amount by which InnoDB
extends the size of a tablespace when it becomes full, making it possible to extend tablespace size in larger increments. AUTOEXTEND_SIZE
选项,它定义了InnoDB
在表空间满时扩展表空间大小的量,从而可以以更大的增量扩展表空间大小。The AUTOEXTEND_SIZE
option is supported with the CREATE TABLE
, ALTER TABLE
, CREATE TABLESPACE
, and ALTER TABLESPACE
statements. CREATE TABLE
、ALTER TABLE
、CREATE TABLESPACE
和ALTER TABLESPACE
语句支持AUTOEXTEND_SIZE
选项。For more information, see Section 15.6.3.9, “Tablespace AUTOEXTEND_SIZE Configuration”.有关更多信息,请参阅第15.6.3.9节,“表空间AUTOEXTEND_SIZE配置”。
An AUTOEXTEND_SIZE
size column was added to the INFORMATION_SCHEMA.INNODB_TABLESPACES
table.
Character set support.字符集支持。 The default character set has changed from 默认字符集已从latin1
to utf8mb4
. latin1
更改为utf8mb4
。The utf8mb4
character set has several new collations, including utf8mb4_ja_0900_as_cs
, the first Japanese language-specific collation available for Unicode in MySQL. utf8mb4
字符集有几个新的排序规则,包括utf8mb4_ja_0900_as_cs
,这是MySQL中第一个针对Unicode的日语特定排序规则。For more information, see Section 10.10.1, “Unicode Character Sets”.有关详细信息,请参阅第10.10.1节,“Unicode字符集”。
JSON enhancements.JSON增强。 The following enhancements or additions were made to MySQL's JSON functionality:对MySQL的JSON功能进行了以下增强或添加:
Added the 添加了->>
(inline path) operator, which is equivalent to calling JSON_UNQUOTE()
on the result of JSON_EXTRACT()
.->>
(内联路径)运算符,相当于对JSON_EXTRACT()
的结果调用JSON_UNQUOTE()
。
This is a refinement of the column path operator 这是对MySQL5.7中引入的列路径运算符->
introduced in MySQL 5.7; col->>"$.path"
is equivalent to JSON_UNQUOTE(col->"$.path")
. ->
的改进;col->>"$.path"
相当于JSON_UNQUOTE(col->"$.path")
。The inline path operator can be used wherever you can use 内联路径运算符可以在任何可以使用JSON_UNQUOTE(JSON_EXTRACT())
, such SELECT
column lists, WHERE
and HAVING
clauses, and ORDER BY
and GROUP BY
clauses. JSON_UNQUOTE(JSON_EXTRACT())
的地方使用,例如SELECT
列列表、WHERE
子句和HAVING
子句以及ORDER BY
子句和GROUP BY
子句。For more information, see the description of the operator, as well as JSON Path Syntax.有关更多信息,请参阅操作符的描述以及JSON路径语法。
Added two JSON aggregation functions 添加了两个JSON聚合函数JSON_ARRAYAGG()
and JSON_OBJECTAGG()
. JSON_ARRAYAGG()
和JSON_OBJECTAGG()
。JSON_ARRAYAGG()
takes a column or expression as its argument, and aggregates the result as a single JSON
array. JSON_ARRAYAGG()
将列或表达式作为其参数,并将结果聚合为单个JSON数组。The expression can evaluate to any MySQL data type; this does not have to be a 表达式可以对任何MySQL数据类型求值;这不必是JSON值。JSON
value. JSON_OBJECTAGG()
takes two columns or expressions which it interprets as a key and a value; it returns the result as a single JSON
object. JSON_OBJECTAGG()
接受两个列或表达式,并将其解释为键和值;它将结果作为单个JSON对象返回。For more information and examples, see Section 12.20, “Aggregate Functions”.有关更多信息和示例,请参阅第12.20节,“聚合函数”。
Added the JSON utility function 添加了JSON实用函数JSON_PRETTY()
, which outputs an existing JSON
value in an easy-to-read format; each JSON object member or array value is printed on a separate line, and a child object or array is intended 2 spaces with respect to its parent.JSON_PRETTY()
,它以易于阅读的格式输出现有的JSON
值;每个JSON对象成员或数组值都打印在单独的行上,子对象或数组相对于其父对象有两个空格。
This function also works with a string that can be parsed as a JSON value.此函数还可以处理可以解析为JSON值的字符串。
For more detailed information and examples, see Section 12.18.8, “JSON Utility Functions”.有关更多详细信息和示例,请参阅第12.18.8节,“JSON实用程序函数”。
When sorting 在使用JSON
values in a query using ORDER BY
, each value is now represented by a variable-length part of the sort key, rather than a part of a fixed 1K in size. ORDER BY
对查询中的JSON
值进行排序时,每个值现在都由排序键的可变长度部分表示,而不是固定1K大小的部分。In many cases this can reduce excessive usage. For example, a scalar 在许多情况下,这可以减少过度使用。例如,标量INT
or even BIGINT
value actually requires very few bytes, so that the remainder of this space (up to 90% or more) was taken up by padding. INT
甚至BIGINT
值实际上只需要很少的字节,因此这个空间的剩余部分(高达90%或更多)被填充占用。This change has the following benefits for performance:此更改对性能有以下好处:
Sort buffer space is now used more effectively, so that filesorts need not flush to disk as early or often as with fixed-length sort keys. 排序缓冲区空间现在得到了更有效的利用,这样文件排序就不必像固定长度排序键那样提前或频繁地刷新到磁盘。This means that more data can be sorted in memory, avoiding unnecessary disk access.这意味着可以在内存中对更多数据进行排序,从而避免不必要的磁盘访问。
Shorter keys can be compared more quickly than longer ones, providing a noticeable improvement in performance. 较短的键可以比较长的键更快地进行比较,从而显著提高了性能。This is true for sorts performed entirely in memory as well as for sorts that require writing to and reading from disk.对于完全在内存中执行的排序,以及需要向磁盘写入和从磁盘读取的排序,都是这样。
Added support in MySQL 8.0.2 for partial, in-place updates of 在MySQL 8.0.2中增加了对JSON列值的部分就地更新的支持,这比完全删除现有的JSON值并在其位置写入新的JSON值更有效,就像以前在更新任何JSON
column values, which is more efficient than completely removing an existing JSON value and writing a new one in its place, as was done previously when updating any JSON
column. JSON
列时所做的那样。For this optimization to be applied, the update must be applied using 要应用此优化,必须使用JSON_SET()
, JSON_REPLACE()
, or JSON_REMOVE()
. JSON_SET()
、JSON_REPLACE()
或JSON_REMOVE()
应用更新。New elements cannot be added to the JSON document being updated; values within the document cannot take more space than they did before the update. 无法将新元素添加到正在更新的JSON文档中;文档中的值占用的空间不能比更新前多。See Partial Updates of JSON Values, for a detailed discussion of the requirements.有关需求的详细讨论,请参阅JSON值的部分更新。
Partial updates of JSON documents can be written to the binary log, taking up less space than logging complete JSON documents. JSON文档的部分更新可以写入二进制日志,比记录完整的JSON文档占用更少的空间。Partial updates are always logged as such when statement-based replication is in use. 当使用基于语句的复制时,部分更新总是这样记录的。For this to work with row-based replication, you must first set 要使用基于行的复制,必须首先设置binlog_row_value_options=PARTIAL_JSON
; see this variable's description for more information.binlog_row_value_options=PARTIAL_JSON
;有关详细信息,请参阅此变量的说明。
Added the JSON utility functions 添加了JSON实用程序函数JSON_STORAGE_SIZE()
and JSON_STORAGE_FREE()
. JSON_STORAGE_SIZE()
和JSON_STORAGE_FREE()
。JSON_STORAGE_SIZE()
returns the storage space in bytes used for the binary representation of a JSON document prior to any partial update (see previous item). JSON_STORAGE_SIZE()
返回在任何部分更新之前用于JSON文档二进制表示的存储空间(以字节为单位)(请参阅上一项)。JSON_STORAGE_FREE()
shows the amount of space remaining in a table column of type JSON
after it has been partially updated using JSON_SET()
or JSON_REPLACE()
; this is greater than zero if the binary representation of the new value is less than that of the previous value.JSON_STORAGE_FREE()
显示JSON类型的表列在使用JSON_SET()
或JSON_REPLACE()
部分更新后剩余的空间量;如果新值的二进制表示形式小于前一个值的二进制表示形式,则该值大于零。
Each of these functions also accepts a valid string representation of a JSON document. 每个函数还接受JSON文档的有效字符串表示形式。For such a value, 对于这样的值,JSON_STORAGE_SIZE()
returns the space used by its binary representation following its conversion to a JSON document. JSON_STORAGE_SIZE()
返回其二进制表示形式转换为JSON文档后使用的空间。For a variable containing the string representation of a JSON document, 对于包含JSON文档字符串表示形式的变量,JSON_STORAGE_FREE()
returns zero. JSON_STORAGE_FREE()
返回零。Either function produces an error if its (non-null) argument cannot be parsed as a valid JSON document, and 如果函数的(非NULL
if the argument is NULL
.null
)参数不能被解析为有效的JSON文档,则会产生错误;如果参数为null
,则会产生null
。
For more information and examples, see Section 12.18.8, “JSON Utility Functions”.有关更多信息和示例,请参阅第12.18.8节,“JSON实用程序函数”。
JSON_STORAGE_SIZE()
and JSON_STORAGE_FREE()
were implemented in MySQL 8.0.2.JSON_STORAGE_SIZE()
和JSON_STORAGE_FREE()
在MySQL 8.0.2中实现。
Added support in MySQL 8.0.2 for ranges such as 在MySQL 8.0.2中添加了对XPath表达式中的$[1 to 5]
in XPath expressions. $[1 to 5]
等范围的支持。Also added support in this version for the 在这个版本中还增加了对last
keyword and relative addressing, such that $[last]
always selects the last (highest-numbered) element in the array and $[last-1]
the next to last element. last
关键字和相对寻址的支持,使得$[last]
始终是选择数组中最后一个(编号最高的)元素,而$[last-1]
总是选择最后一个元素的前一个。last
and expressions using it can also be included in range definitions. last
和使用它的表达式也可以包含在范围定义中。For example, 例如,$[last-2 to last-1]
returns the last two elements but one from an array. $[last-2 to last-1]
返回最后两个元素,但一个元素来自数组。See Searching and Modifying JSON Values, for additional information and examples.有关更多信息和示例,请参阅搜索和修改JSON值。
Added a JSON merge function intended to conform to RFC 7396. 添加了一个JSON合并函数,以符合RFC 7396。JSON_MERGE_PATCH()
, when used on 2 JSON objects, merges them into a single JSON object that has as members a union of the following sets:JSON_MERGE_PATCH()
用于2个JSON对象时,会将它们合并为一个JSON对象,该对象的成员为以下集合的并集:
Each member of the first object for which there is no member with the same key in the second object.第一个对象的每个成员,其中第二个对象中没有具有相同键的成员。
Each member of the second object for which there is no member having the same key in the first object, and whose value is not the JSON 第二个对象的每个成员,其中第一个对象中没有具有相同键的成员,并且其值不是JSON null
literal.null
文本。
Each member having a key that exists in both objects, and whose value in the second object is not the JSON 每个成员都有一个键,该键存在于两个对象中,并且在第二个对象中的值不是JSON null
literal.null
文本。
As part of this work, the 作为这项工作的一部分,JSON_MERGE()
function has been renamed JSON_MERGE_PRESERVE()
. JSON_MERGE()
函数被重命名为JSON_MERGE_PRESERVE()
。在MySQL 8.0中,JSON_MERGE()
continues to be recognized as an alias for JSON_MERGE_PRESERVE()
in MySQL 8.0, but is now deprecated and is subject to removal in a future version of MySQL.JSON_MERGE()
仍然被认为是JSON_MERGE_PRESERVE()
的别名,但现在已被弃用,在MySQL的未来版本中可能会被删除。
For more information and examples, see Section 12.18.4, “Functions That Modify JSON Values”.有关更多信息和示例,请参阅第12.18.4节,“修改JSON值的函数”。
Implemented “last duplicate key wins” normalization of duplicate keys, consistent with RFC 7159 and most JavaScript parsers. 实现了重复密钥的“最后重复的建胜出”规范化,与RFC 7159和大多数JavaScript解析器一致。An example of this behavior is shown here, where only the rightmost member having the key 此行为的示例如下所示,其中仅保留具有键x
is preserved:x
的最右侧成员:
mysql> SELECTJSON_OBJECT('x', '32', 'y', '[true, false]',
>'x', '"abc"', 'x', '100') AS Result;
+------------------------------------+ | Result | +------------------------------------+ | {"x": "100", "y": "[true, false]"} | +------------------------------------+ 1 row in set (0.00 sec)
Values inserted into MySQL 插入到MySQL JSON
columns are also normalized in this way, as shown in this example:JSON
列中的值也以这种方式进行规范化,如下例所示:
mysql>CREATE TABLE t1 (c1 JSON);
mysql>INSERT INTO t1 VALUES ('{"x": 17, "x": "red", "x": [3, 5, 7]}');
mysql>SELECT c1 FROM t1;
+------------------+ | c1 | +------------------+ | {"x": [3, 5, 7]} | +------------------+
This is an incompatible change from previous versions of MySQL, where a “first duplicate key wins” algorithm was used in such cases.这与MySQL以前的版本是不兼容的,MySQL在这种情况下使用了“第一个重复的键胜出”算法。
See Normalization, Merging, and Autowrapping of JSON Values, for more information and examples.有关更多信息和示例,请参见JSON值的规范化、合并和自动包装。
Added the 在MySQL 8.0.4中增加了JSON_TABLE()
function in MySQL 8.0.4. JSON_TABLE()
函数。This function accepts JSON data and returns it as a relational table having the specified columns.此函数接受JSON数据并将其作为具有指定列的关系表返回。
This function has the syntax 此函数的语法为JSON_TABLE(
, where expr
, path
COLUMNS column_list
) [AS] alias
)expr
is an expression that returns JSON data, path
is a JSON path applied to the source, and column_list
is a list of column definitions. SON_TABLE(
,其中expr
, path
COLUMNS column_list
) [AS] alias
)expr
是返回JSON数据的表达式,path
是应用于源的JSON路径,column_list
是列定义的列表。An example is shown here:示例如下:
mysql>SELECT *
->FROM
->JSON_TABLE(
->'[{"a":3,"b":"0"},{"a":"3","b":"1"},{"a":2,"b":1},{"a":0},{"b":[1,2]}]',
->"$[*]" COLUMNS(
->rowid FOR ORDINALITY,
-> ->xa INT EXISTS PATH "$.a",
->xb INT EXISTS PATH "$.b",
-> ->sa VARCHAR(100) PATH "$.a",
->sb VARCHAR(100) PATH "$.b",
-> ->ja JSON PATH "$.a",
->jb JSON PATH "$.b"
->)
->) AS jt1;
+-------+------+------+------+------+------+--------+ | rowid | xa | xb | sa | sb | ja | jb | +-------+------+------+------+------+------+--------+ | 1 | 1 | 1 | 3 | 0 | 3 | "0" | | 2 | 1 | 1 | 3 | 1 | "3" | "1" | | 3 | 1 | 1 | 2 | 1 | 2 | 1 | | 4 | 1 | 0 | 0 | NULL | 0 | NULL | | 5 | 0 | 1 | NULL | NULL | NULL | [1, 2] | +-------+------+------+------+------+------+--------+
The JSON source expression can be any expression that yields a valid JSON document, including a JSON literal, a table column, or a function call that returns JSON such as JSON源表达式可以是生成有效JSON文档的任何表达式,包括JSON文本、表列或返回JSON的函数调用,例如JSON_EXTRACT(t1, data, '$.post.comments')
. JSON_EXTRACT(t1, data, '$.post.comments')
。For more information, see Section 12.18.6, “JSON Table Functions”.有关更多信息,请参阅第12.18.6节,“JSON表函数”。
Data type support.数据类型支持。 MySQL now supports use of expressions as default values in data type specifications. MySQL现在支持在数据类型规范中使用表达式作为默认值。This includes the use of expressions as default values for the 这包括使用表达式作为BLOB
, TEXT
, GEOMETRY
, and JSON
data types, which previously could not be assigned default values at all. BLOB
、TEXT
、GEOMETRY
和JSON
数据类型的默认值,这些数据类型以前根本不能被分配默认值。For details, see Section 11.6, “Data Type Default Values”.有关详细信息,请参阅第11.6节,“数据类型默认值”。
Optimizer.优化器。 These optimizer enhancements were added:添加了以下优化程序增强功能:
MySQL now supports invisible indexes. MySQL现在支持不可见索引。An invisible index is not used by the optimizer at all, but is otherwise maintained normally. 不可见索引根本不被优化器使用,而是正常维护。Indexes are visible by default. 默认情况下,索引是可见的。Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. 不可见索引使测试删除索引对查询性能的影响成为可能,而无需进行破坏性的更改(如果索引是必需的,则必须撤消这些更改)。See Section 8.3.12, “Invisible Indexes”.请参阅第8.3.12节,“不可见索引”。
MySQL now supports descending indexes: MySQL现在支持降序索引:索引定义中的DESC
in an index definition is no longer ignored but causes storage of key values in descending order. DESC
不再被忽略,而是导致按降序存储键值。Previously, indexes could be scanned in reverse order but at a performance penalty. 以前,索引可以按相反的顺序扫描,但性能会受到影响。A descending index can be scanned in forward order, which is more efficient. 降序索引可以按正向顺序扫描,这样效率更高。Descending indexes also make it possible for the optimizer to use multiple-column indexes when the most efficient scan order mixes ascending order for some columns and descending order for others. 当最有效的扫描顺序混合了某些列的升序和其他列的降序时,降序索引还使优化器可以使用多个列索引。See Section 8.3.13, “Descending Indexes”.见第8.3.13节,“降序索引”。
MySQL now supports creation of functional index key parts that index expression values rather than column values. MySQL现在支持创建索引表达式值而不是列值的函数索引键部分。Functional key parts enable indexing of values that cannot be indexed otherwise, such as 功能键部件支持对无法索引的值(如JSON
values. JSON
值)进行索引。For details, see Section 13.1.15, “CREATE INDEX Statement”.有关详细信息,请参阅第13.1.15节,“创建索引语句”。
In MySQL 8.0.14 and later, trivial 在MySQL 8.0.14及更高版本中,在准备过程中(而不是以后的优化过程中)常量文本表达式产生的琐碎的WHERE
conditions arising from constant literal expressions are removed during preparation, rather than later on during optimization. WHERE
条件会被删除。Removal of the condition earlier in the process makes it possible to simplify joins for queries with outer joins having trivial conditions, such as this one:在流程的早期删除条件,可以简化查询的联接,外部联接具有普通条件,例如:
SELECT * FROM t1 LEFT JOIN t2 ONcondition_1
WHEREcondition_2
OR 0 = 1
The optimizer now sees during preparation that 0 = 1 is always false, making 优化器现在在准备过程中看到0=1始终是OR 0 = 1
redundant, and removes it, leaving this:false
,使OR 0=1
成为冗余,并将其删除,留下以下内容:
SELECT * FROM t1 LEFT JOIN t2 ONcondition_1
wherecondition_2
Now the optimizer can rewrite the query as an inner join, like this:现在,优化器可以将查询重写为内部联接,如下所示:
SELECT * FROM t1 LEFT JOIN t2 WHEREcondition_1
ANDcondition_2
For more information, see Section 8.2.1.9, “Outer Join Optimization”.有关更多信息,请参阅第8.2.1.9节,“外部连接优化”。
In MySQL 8.0.16 and later, MySQL can use constant folding at optimization time to handle comparisons between a column and a constant value where the constant is out of range or on a range boundary with respect to the type of the column, rather than doing so for each row at execution time. 在MySQL 8.0.16及更高版本中,MySQL可以在优化时使用常量折叠来处理列与常量值之间的比较,其中常量超出范围或位于与列类型相关的范围边界上,而不是在执行时对每一行进行比较。For example, given a table 例如,给定一个表t
with a TINYINT UNSIGNED
column c
, the optimizer can rewrite a condition such as WHERE c < 256
to WHERE 1
(and optimize the condition away altogether), or WHERE c >= 255
to WHERE c = 255
.t
,其中有一个TINYINT UNSIGNED
列c
,优化器可以重写一个条件,例如WHERE c<256
变成WHERE 1
(同时优化条件),或WHERE c>=255
变为WHERE c=255
。
See Section 8.2.1.14, “Constant-Folding Optimization”, for more information.详见第8.2.1.14节,“常量折叠优化”。
Beginning with MySQL 8.0.16, the semijoin optimizations used with 从MySQL 8.0.16开始,与IN
subqueries can now be applied to EXISTS
subqueries as well. IN
子查询配合使用的半连接优化现在也可以应用于EXISTS
子查询。In addition, the optimizer now decorrelates trivially-correlated equality predicates in the 此外,优化器现在对附加到子查询的WHERE
condition attached to the subquery, so that they can be treated similarly to expressions in IN
subqueries; this applies to both EXISTS
and IN
subqueries.WHERE
条件中的无关紧要的相关相等谓词进行解相关,以便它们可以像IN
子查询中的表达式一样进行处理;这适用于EXISTS
子查询和IN
子查询。
For more information, see Section 8.2.2.1, “Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations”.有关详细信息,请参阅第8.2.2.1节,“使用半联接转换优化IN和EXISTS子查询谓词”。
As of MySQL 8.0.17, the server rewrites any incomplete SQL predicates (that is, predicates having the form 从MySQL 8.0.17开始,服务器会在内部将任何不完整的SQL谓词(即形式为WHERE
, in which value
value
is a column name or constant expression and no comparison operator is used) internally as WHERE
during the contextualization phase, so that the query resolver, query optimizer, and query executor need work only with complete predicates.value
<> 0WHERE
的谓词,其中value
value
是列名或常量表达式,没有使用比较运算符)在上下文化阶段重写为WHERE
,因此查询解析器、查询优化器和查询执行器只需要使用完整的谓词。value
<> 0
One visible effect of this change is that, for Boolean values, 此更改的一个明显效果是,对于布尔值,EXPLAIN
output now shows true
and false
, rather than 1
and 0
.EXPLAIN
输出现在显示true
和false
,而不是1
和0
。
Another effect of this change is that evaluation of a JSON value in an SQL boolean context performs an implicit comparison against JSON integer 0. 此更改的另一个影响是,在SQL布尔上下文中对JSON值的求值执行与JSON整数0的隐式比较。Consider the table created and populated as shown here:考虑创建和填充的表,如下面所示:
mysql>CREATE TABLE test (id INT, col JSON);
mysql>INSERT INTO test VALUES (1, '{"val":true}'), (2, '{"val":false}');
Previously, the server attempted to convert an extracted 以前,在SQL布尔上下文中比较提取的true
or false
value to an SQL boolean when comparing it in an SQL boolean context, as shown by the following query using IS TRUE
:true
值或false
值时,服务器尝试将其转换为SQL布尔值,如下使用IS TRUE
的查询所示:
mysql> SELECT id, col, col->"$.val" FROM test WHERE col->"$.val" IS TRUE;
+------+---------------+--------------+
| id | col | col->"$.val" |
+------+---------------+--------------+
| 1 | {"val": true} | true |
+------+---------------+--------------+
In MySQL 8.0.17 and later, the implicit copmparison of the extracted value with JSON integer 0 leads to a different result:在MySQL 8.0.17及更高版本中,将提取的值与JSON整数0进行隐式比较会导致不同的结果:
mysql> SELECT id, col, col->"$.val" FROM test WHERE col->"$.val" IS TRUE;
+------+----------------+--------------+
| id | col | col->"$.val" |
+------+----------------+--------------+
| 1 | {"val": true} | true |
| 2 | {"val": false} | false |
+------+----------------+--------------+
Beginning with MySQL 8.0.21, you can use 从MySQL 8.0.21开始,您可以在执行测试之前,对提取的值使用JSON_VALUE()
on the extracted value to perform type conversion prior to performing the test, as shown here:JSON_VALUE()
进行类型转换,如下所示:
mysql>SELECT id, col, col->"$.val" FROM test
->WHERE JSON_VALUE(col, "$.val" RETURNING UNSIGNED) IS TRUE;
+------+---------------+--------------+ | id | col | col->"$.val" | +------+---------------+--------------+ | 1 | {"val": true} | true | +------+---------------+--------------+
Also beginning with MySQL 8.0.21, the server provides the warning Evaluating a JSON value in SQL boolean context does an implicit comparison against JSON integer 0; if this is not what you want, consider converting JSON to an SQL numeric type with JSON_VALUE RETURNING when comparing extracted values in an SQL boolean context in this manner.同样从MySQL8.0.21开始,服务器提供警告:在SQL布尔上下文中计算JSON值时,会隐式比较JSON整数0;如果这不是你想要的,考虑将JSON转换成SQL数字类型,当以这种方式比较在SQL布尔上下文中提取的值时,JSON1值返回。
In MySQL 8.0.17 and later a 在MySQL 8.0.17及更高版本中,WHERE
condition having NOT IN (
or subquery
)NOT EXISTS (
is transformed internally into an antijoin. subquery
)WHERE
条件NOT IN (
或subquery
)NOT EXISTS (
在内部转换为反连接。subquery
)(An antijoin returns all rows from the table for which there is no row in the table to which it is joined matching the join condition.) (反联接返回表中的所有行,如果该表中没有与联接条件匹配的行被联接到该表中。)This removes the subquery which can result in faster query execution since the subquery's tables are now handled on the top level.这将删除子查询,这将导致更快的查询执行,因为子查询的表现在在顶层处理。
This is similar to, and reuses, the existing 这类似于并重用现有的针对外部联接的IS NULL
(Not exists
) optimization for outer joins; see EXPLAIN Extra Information.IS NULL
(Not exists
)优化;请参见解释其他信息。
Beginning with MySQL 8.0.21, a single-table 从MySQL 8.0.21开始,单个表UPDATE
or DELETE
statement can now in many cases make use of a semijoin transformation or subquery materialization. UPDATE
或DELETE
语句现在可以在许多情况下使用半连接转换或子查询具体化。This applies to statements of the forms shown here:这适用于以下表格的陈述:
UPDATE t1 SET t1.a=
value
WHERE t1.a IN (SELECT t2.a FROM t2)
DELETE FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2)
This can be done for a single-table 对于满足以下条件的单个表UPDATE
or DELETE
meeting the following conditions:UPDATE
或DELETE
,可以执行此操作:
The UPDATE
or DELETE
statement uses a subquery having a [NOT] IN
or [NOT] EXISTS
predicate.UPDATE
语句或DELETE
语句使用一个子查询,该子查询具有[NOT] IN
或[NOT] EXISTS
谓词。
The statement has no 语句没有ORDER BY
clause, and has no LIMIT
clause.ORDER BY
子句,也没有LIMIT
子句。
(The multi-table versions of (UPDATE
and DELETE
do not support ORDER BY
or LIMIT
.)UPDATE
和DELETE
的多表版本不支持ORDER BY
或LIMIT
。)
The target table does not support read-before-write removal (relevant only for 目标表不支持先读后写删除(仅与NDB
tables).NDB
表相关)。
Semijoin or subquery materialization is allowed, based on any hints contained in the subquery and the value of 基于子查询中包含的任何提示和optimizer_switch
.optimizer_switch
的值,允许半联接或子查询具体化。
When the semijoin optimization is used for an eligible single-table 当半联接优化用于符合条件的单表DELETE
or UPDATE
, this is visible in the optimizer trace: for a multi-table statement there is a join_optimization
object in the trace, while there is none for a single-table statement. DELETE
或UPDATE
时,这在优化器跟踪中是可见的:对于多表语句,跟踪中有一个联接优化对象,而对于单表语句则没有。The conversion is also visible in the output of 转换也可以在EXPLAIN FORMAT=TREE
or EXPLAIN ANALYZE
; a single-table statement shows <not executable by iterator executor>
, while a multi-table statement reports a full plan.EXPLAIN FORMAT=TREE
或EXPLAIN ANALYZE
的输出中看到;单个表语句显示<迭代器执行器不能执行>
,而多表语句则报告完整的计划。
Also beginning with MySQL 8.0.21, semi-consistent reads are supported by multi-table 并且从MySQL8.0.21开始,使用UPDATE
statements using InnoDB
tables, for transaction isolation levels weaker than REPEATABLE READ
.InnoDB
表的多表UPDATE
语句支持半一致读取,因为事务隔离级别弱于REPEATABLE READ
。
Improved hash join performance.提高了哈希连接性能。 MySQL 8.0.23 reimplements the hash table used for hash joins, resulting in several improvements in hash join performance. MySQL8.0.23重新实现了用于哈希连接的哈希表,从而在哈希连接性能方面有了一些改进。This work includes a fix for an issue (Bug #31516149, Bug #99933) whereby only roughly 2/3 of the memory allocated for the join buffer (这项工作包括对一个问题(Bug#31516149,Bug#99933)的修复,其中只有大约2/3的内存分配给连接缓冲区(join_buffer_size
) could actually be used by a hash join.join_buffer_size
)可以被哈希连接实际使用。
The new hash table is generally faster than the old one, and uses less memory for alignment, keys/values, and in scenarios where there are many equal keys. 新的哈希表通常比旧的哈希表更快,并且在对齐、键/值以及存在许多相等键的情况下使用更少的内存。In addition, the server can now free old memory when the size of the hash table increases.此外,当哈希表的大小增加时,服务器现在可以释放旧内存。
Common table expressions.常用表表达式。 MySQL now supports common table expressions, both nonrecursive and recursive. MySQL现在支持非递归和递归的通用表表达式。Common table expressions enable use of named temporary result sets, implemented by permitting a 公共表表达式允许使用命名的临时结果集,通过允许在WITH
clause preceding SELECT
statements and certain other statements. SELECT
语句和某些其他语句之前使用WITH
子句来实现。For more information, see Section 13.2.15, “WITH (Common Table Expressions)”.有关更多信息,请参阅第13.2.15节,“WITH(公共表表达式)”。
As of MySQL 8.0.19, the recursive 从MySQL8.0.19开始,递归公共表表达式(CTE)的递归SELECT
part of a recursive common table expression (CTE) supports a LIMIT
clause. SELECT
部分支持LIMIT
子句。还支持带LIMIT
with OFFSET
is also supported. OFFSET
的LIMIT
。See Recursive Common Table Expressions, for more information.有关详细信息,请参阅递归公共表表达式。
Window functions.窗口函数。 MySQL now supports window functions that, for each row from a query, perform a calculation using rows related to that row. MySQL现在支持窗口函数,对于查询中的每一行,使用与该行相关的行执行计算。These include functions such as 这些函数包括RANK()
, LAG()
, and NTILE()
. RANK()
、LAG()
和NTILE()
等函数。In addition, several existing aggregate functions now can be used as window functions (for example, 此外,一些现有的聚合函数现在可以用作窗口函数(例如SUM()
and AVG()
). SUM()
和AVG()
)。For more information, see Section 12.21, “Window Functions”.有关更多信息,请参阅第12.21节,“窗口函数”。
Lateral derived tables.横向派生表。 A derived table now may be preceded by the 现在,派生表前面可以加上LATERAL
keyword to specify that it is permitted to refer to (depend on) columns of preceding tables in the same FROM
clause. LATERAL
关键字,以指定允许它在同一FROM
子句中引用(依赖)前面表的列。Lateral derived tables make possible certain SQL operations that cannot be done with nonlateral derived tables or that require less-efficient workarounds. 横向派生表使某些SQL操作成为可能,这些操作无法用非横向派生表完成,或者需要效率较低的变通方法。See Section 13.2.11.9, “Lateral Derived Tables”.请参阅第13.2.11.9节,“横向派生表”。
Aliases in single-table DELETE statements.单表DELETE语句中的别名。 In MySQL 8.0.16 and later, single-table 在MySQL 8.0.16及更高版本中,单表DELETE
statements support the use of table aliases.DELETE
语句支持使用表别名。
Regular expression support.正则表达式支持。 Previously, MySQL used the Henry Spencer regular expression library to support regular expression operators (以前,MySQL使用Henry Spencer正则表达式库来支持正则表达式操作符(REGEXP
, RLIKE
). REGEXP
,RLIKE
)。Regular expression support has been reimplemented using International Components for Unicode (ICU), which provides full Unicode support and is multibyte safe. 正则表达式支持已经使用国际Unicode组件(ICU)重新实现,它提供了完整的Unicode支持,并且是多字节安全的。The REGEXP_LIKE()
function performs regular expression matching in the manner of the REGEXP
and RLIKE
operators, which now are synonyms for that function. REGEXP_LIKE()
函数以REGEXP
运算符和RLIKE
运算符的方式执行正则表达式匹配,现在它们是该函数的同义词。In addition, the 此外,REGEXP_INSTR()
, REGEXP_REPLACE()
, and REGEXP_SUBSTR()
functions are available to find match positions and perform substring substitution and extraction, respectively. REGEXP_INSTR()
、REGEXP_REPLACE()
和REGEXP_SUBSTR()
函数分别用于查找匹配位置和执行子字符串替换和提取。The regexp_stack_limit
and regexp_time_limit
system variables provide control over resource consumption by the match engine. regexp_stack_limit
和regexp_time_limit
系统变量提供对匹配引擎的资源消耗的控制。For more information, see Section 12.8.2, “Regular Expressions”. 有关更多信息,请参阅第12.8.2节,“正则表达式”。For information about ways in which applications that use regular expressions may be affected by the implementation change, see Regular Expression Compatibility Considerations.有关使用正则表达式的应用程序受实现更改影响的方式的信息,请参阅正则表达式兼容性注意事项。
Internal temporary tables.内部临时表。 The TempTable
storage engine replaces the MEMORY
storage engine as the default engine for in-memory internal temporary tables. TempTable
存储引擎取代MEMORY
存储引擎作为内存内部临时表的默认引擎。The TempTable
storage engine provides efficient storage for VARCHAR
and VARBINARY
columns. TempTable
存储引擎为VARCHAR
和VARBINARY
列提供了高效的存储。The internal_tmp_mem_storage_engine
session variable defines the storage engine for in-memory internal temporary tables. internal_tmp_mem_storage_engine
会话变量定义内存内部临时表的存储引擎。Permitted values are 允许的值是TempTable
(the default) and MEMORY
. TempTable
(默认值)和MEMORY
。The temptable_max_ram
variable defines the maximum amount of memory that the TempTable
storage engine can use before data is stored to disk.testable_max_ram
变量定义了在数据存储到磁盘之前,TempTable
存储引擎可以使用的最大内存量。
Logging.日志。 Error logging was rewritten to use the MySQL component architecture. 错误日志记录被重写为使用MySQL组件体系结构。Traditional error logging is implemented using built-in components, and logging using the system log is implemented as a loadable component. 传统的错误日志记录是使用内置组件实现的,而使用系统日志记录是作为可加载组件实现的。In addition, a loadable JSON log writer is available. 此外,还提供了一个可加载的JSON日志编写器。To control which log components to enable, use the 要控制要启用哪些日志组件,请使用log_error_services
system variable. log_error_services
系统变量。For more information, see Section 5.4.2, “The Error Log”.有关更多信息,请参阅第5.4.2节,“错误日志”。
Backup lock.备用锁。 A new type of backup lock permits DML during an online backup while preventing operations that could result in an inconsistent snapshot. 一种新类型的备份锁允许在联机备份期间使用DML,同时防止可能导致快照不一致的操作。The new backup lock is supported by LOCK INSTANCE FOR BACKUP
and UNLOCK INSTANCE
syntax. LOCK INSTANCE FOR BACKUP
语法和UNLOCK INSTANCE
语法支持新的备份锁。The 使用这些语句需要BACKUP_ADMIN
privilege is required to use these statements.BACKUP_ADMIN
权限。
Replication.复制。 The following enhancements have been made to MySQL Replication:对MySQL复制进行了以下增强:
MySQL Replication now supports binary logging of partial updates to JSON documents using a compact binary format, saving space in the log over logging complete JSON documents. MySQL复制现在支持使用紧凑的二进制格式对JSON文档的部分更新进行二进制日志记录,在记录完整的JSON文档时节省了日志空间。Such compact logging is done automatically when statement-based logging is in use, and can be enabled by setting the new 当使用基于语句的日志记录时,这种紧凑的日志记录会自动完成,并且可以通过将新的binlog_row_value_options
system variable to PARTIAL_JSON
. binlog_row_value_options
系统变量设置为PARTIAL_JSON
来启用。For more information, see Partial Updates of JSON Values, as well as the description of 有关更多信息,请参阅JSON值的部分更新,以及binlog_row_value_options
.binlog_row_value_options
的说明。
Connection management.连接管理。 MySQL Server now permits a TCP/IP port to be configured specifically for administrative connections. MySQL服务器现在允许专门为管理连接配置TCP/IP端口。This provides an alternative to the single administrative connection that is permitted on the network interfaces used for ordinary connections even when 这提供了一种替代单一管理连接的方法,该方法允许在用于普通连接的网络接口上使用,即使已经建立了max_connections
connections are already established. max_connections
连接。See Section 5.1.12.1, “Connection Interfaces”.请参阅第5.1.12.1节,“连接接口”。
MySQL now provides more control over the use of compression to minimize the number of bytes sent over connections to the server. MySQL现在提供了对压缩使用的更多控制,以最小化通过连接发送到服务器的字节数。Previously, a given connection was either uncompressed or used the 以前,给定的连接要么未压缩,要么使用zlib
compression algorithm. zlib
压缩算法。Now, it is also possible to use the 现在,还可以使用zstd
algorithm, and to select a compression level for zstd
connections. zstd
算法,并为zstd连接选择压缩级别。The permitted compression algorithms can be configured on the server side, as well as on the connection-origination side for connections by client programs and by servers participating in source/replica replication or Group Replication. 允许的压缩算法可以在服务器端配置,也可以在连接发起端配置,用于客户端程序和参与源/副本复制或组复制的服务器的连接。For more information, see Section 4.2.8, “Connection Compression Control”.有关更多信息,请参阅第4.2.8节,“连接压缩控制”。
Configuration.配置 The maximum permitted length of host names throughout MySQL has been raised to 255 ASCII characters, up from the previous limit of 60 characters. MySQL中主机名的最大允许长度从以前的60个字符提高到255个ASCII字符。This applies to, for example, host name-related columns in the data dictionary, 例如,这适用于数据字典、mysql
system schema, Performance Schema, INFORMATION_SCHEMA
, and sys
schema; the MASTER_HOST
value for the CHANGE MASTER TO
statement; the Host
column in SHOW PROCESSLIST
statement output; host names in account names (such as used in account-management statements and in DEFINER
attributes); and host name-related command options and system variables.mysql
系统模式、性能架构、INFORMATION_SCHEMA
和sys
模式中与主机名相关的列;CHANGE MASTER TO
语句的MASTER_HOST
值;SHOW PROCESSLIST
语句输出中的Host
列;帐户名中的主机名(如用于帐户管理语句和定义器属性);和主机名相关的命令选项和系统变量。
Caveats:注意事项:
The increase in permitted host name length can affect tables with indexes on host name columns. 允许的主机名长度的增加可能会影响在主机名列上具有索引的表。For example, tables in the 例如,mysql
system schema that index host names now have an explicit ROW_FORMAT
attribute of DYNAMIC
to accommodate longer index values.mysql
系统模式中索引主机名的表现在有一个显式的ROW_FORMAT
属性DYNAMIC
,以容纳更长的索引值。
Some file name-valued configuration settings might be constructed based on the server host name. 可能会基于服务器主机名构造某些文件名值配置设置。The permitted values are constrained by the underlying operating system, which may not permit file names long enough to include 255-character host names. 允许的值受基础操作系统的限制,该操作系统可能不允许文件名的长度足以包含255个字符的主机名。This affects the 这会影响general_log_file
, log_error
, pid_file
, relay_log
, and slow_query_log_file
system variables and corresponding options. general_log_file
、log_error
、pid_file
、relay_log
和slow_query_log_file
系统变量和相应的选项。If host name-based values are too long for the OS, explicit shorter values must be provided.如果基于主机名的值对于操作系统太长,则必须提供显式的较短值。
Although the server now supports 255-character host names, connections to the server established using the 尽管服务器现在支持255个字符的主机名,但是使用--ssl-mode=VERIFY_IDENTITY
option are constrained by maximum host name length supported by OpenSSL. --ssl-mode=VERIFY_IDENTITY
选项建立的到服务器的连接受到OpenSSL支持的最大主机名长度的限制。Host name matches pertain to two fields of SSL certificates, which have maximum lengths as follows: Common Name: maximum length 64; Subject Alternative Name: maximum length as per RFC#1034.主机名匹配与SSL证书的两个字段有关,其最大长度如下:公用名:最大长度64;受试者备选名称:最大长度根据RFC#1034。
Plugins.插件。 Previously, MySQL plugins could be written in C or C++. 以前,MySQL插件可以用C或C++编写。MySQL header files used by plugins now contain C++ code, which means that plugins must be written in C++, not C.现在插件使用的MySQL头文件包含C++代码,这意味着插件必须用C++编写,而不是C。
C API.C API。 The MySQL C API now supports asynchronous functions for nonblocking communication with the MySQL server. MySQL C API现在支持异步函数,以实现与MySQL服务器的非阻塞通信。Each function is the asynchronous counterpart to an existing synchronous function. 每个函数都是现有同步函数的异步对应项。The synchronous functions block if reads from or writes to the server connection must wait. 如果从服务器连接读取或写入必须等待,则同步函数将阻止。The asynchronous functions enable an application to check whether work on the server connection is ready to proceed. 异步函数使应用程序能够检查服务器连接上的工作是否准备好继续。If not, the application can perform other work before checking again later. 如果没有,应用程序可以在稍后再次检查之前执行其他工作。See C API Asynchronous Interface.请参阅C API异步接口。
Additional target types for casts.强制转换的其他目标类型。 The functions 函数CAST()
and CONVERT()
now support conversions to types DOUBLE
, FLOAT
, and REAL
. CAST()
和CONVERT()
现在支持转换为DOUBLE
、FLOAT
和REAL
类型。Added in MySQL 8.0.17. 在MySQL 8.0.17中添加。See Section 12.11, “Cast Functions and Operators”.请参阅第12.11节,“强制转换函数和运算符”。
JSON schema validation.JSON架构验证。 MySQL 8.0.17 adds two functions MySQL 8.0.17增加了两个函数JSON_SCHEMA_VALID()
and JSON_SCHEMA_VALIDATION_REPORT()
for validating JSON documents again JSON schemas. JSON_SCHEMA_VALID()
和JSON_SCHEMA_VALIDATION_REPORT()
,用于再次验证JSON文档和JSON模式。JSON_SCHEMA_VALID()
returns TRUE (1) if the document validates against the schema and FALSE (0) if it does not. JSON_SCHEMA_VALID()
如果文档根据架构进行验证,则返回TRUE
(1),否则返回FALSE
(0)。JSON_SCHEMA_VALIDATION_REPORT()
returns a JSON document containing detailed information about the results of the validation. JSON_SCHEMA_VALIDATION_REPORT()
返回一个JSON文档,其中包含有关验证结果的详细信息。The following statements apply to both of these functions:以下语句适用于这两个函数:
The schema must conform to Draft 4 of the JSON Schema specification.模式必须符合JSON模式规范的草案4。
支持required
attributes are supported.required
属性。
External resources and the 不支持外部资源和$ref
keyword are not supported.$ref
关键字。
Regular expression patterns are supported; invalid patterns are silently ignored.支持正则表达式模式;无效的模式将被自动忽略。
See Section 12.18.7, “JSON Schema Validation Functions”, for more information and examples.有关更多信息和示例,请参阅第12.18.7节,“JSON模式验证函数”。
Multi-valued indexes.多值索引。 Beginning with MySQL 8.0.17, 从MySQL8.0.17开始,InnoDB
supports the creation of a multi-valued index, which is a secondary index defined on a JSON
column that stores an array of values and which can have multiple index records for a single data record. InnoDB
支持创建多值索引,它是一个在JSON
列上定义的二级索引,存储一个值数组,对于一个数据记录可以有多个索引记录。Such an index uses a key part definition such as 这样的索引使用关键部分定义,例如CAST(data->'$.zipcode' AS UNSIGNED ARRAY)
. CAST(data->'$.zipcode' AS UNSIGNED ARRAY)
。A multi-valued index is used automatically by the MySQL optimizer for suitable queries, as can be viewed in the output of 多值索引由MySQL优化器自动用于适当的查询,如EXPLAIN
.EXPLAIN
的输出所示。
As part of this work, MySQL adds a new function 作为这项工作的一部分,MySQL添加了一个新函数JSON_OVERLAPS()
and a new MEMBER OF()
operator for working with JSON
documents, additionally extending the CAST()
function with a new ARRAY
keyword, as described in the following list:JSON_OVERLAPS()
和一个新的MEMBER OF()
运算符来处理JSON
文档,另外还使用一个新的ARRAY
关键字扩展了CAST()
函数,如下表所示:
JSON_OVERLAPS()
compares two JSON
documents. JSON_OVERLAPS()
比较两个JSON文档。If they contain any key-value pairs or array elements in common, the function returns TRUE (1); otherwise it returns FALSE (0). 如果它们共同包含任何键值对或数组元素,则函数返回TRUE
(1);否则返回FALSE
(0)。If both values are scalars, the function performs a simple test for equality. 如果两个值都是标量,则函数将执行简单的相等性测试。If one argument is a JSON array and the other is a scalar, the scalar is treated as an array element. 如果一个参数是JSON数组,另一个是标量,则标量将被视为数组元素。Thus, 因此,JSON_OVERLAPS()
acts as a complement to JSON_CONTAINS()
.JSON_OVERLAPS()
作为JSON_CONTAINS()
的补充。
MEMBER OF()
tests whether the first operand (a scalar or JSON document) is a member of the JSON array passed as the second operand, returning TRUE (1) if it is, and FALSE (0) if it is not. MEMBER OF()
测试第一个操作数(标量或JSON文档)是否是作为第二个操作数传递的JSON数组的成员,如果是,则返回TRUE
(1),如果不是,则返回FALSE
(0)。No type conversion of the operand is performed.不执行操作数的类型转换。
CAST(
permits creation of a functional index by casting the JSON array found in a JSON document at expression
AS type
ARRAY)json_path
to an SQL array. CAST(
允许通过将JSON文档中expression
AS type
ARRAY)json_path
上的JSON数组转换为SQL数组来创建函数索引。Type specifiers are limited to those already supported by 类型说明符仅限于CAST()
, with the exception of BINARY
(not supported). CAST()
已支持的类型说明符,但BINARY
除外(不支持)。This usage of 只有CAST()
(and the ARRAY
keyword) is supported only by InnoDB
, and only for the creation of a multi-valued index.InnoDB
支持CAST()
(和ARRAY
关键字)的这种用法,并且只有在创建多值索引时才支持。
For detailed information about multi-valued indexes, including examples, see Multi-Valued Indexes. 有关多值索引(包括示例)的详细信息,请参阅多值索引。Section 12.18.3, “Functions That Search JSON Values”, provides information about 第12.18.3节,“搜索JSON值的函数”提供了有关JSON_OVERLAPS()
and MEMBER OF()
, along with examples of use.JSON_OVERLAPS()
和MEMBER OF()
的信息,以及使用示例。
Hintable time_zone.可隐藏的时区。 As of MySQL 8.0.17, the 从MySQL8.0.17开始,time_zone
session variable is hintable using SET_VAR
.time_zone
会话变量可以使用SET_VAR
隐藏。
Redo Log Archiving.重做日志存档。 As of MySQL 8.0.17, 从MySQL8.0.17开始,InnoDB
supports redo log archiving. InnoDB
支持重做日志归档。Backup utilities that copy redo log records may sometimes fail to keep pace with redo log generation while a backup operation is in progress, resulting in lost redo log records due to those records being overwritten. 当备份操作正在进行时,复制重做日志记录的备份实用程序有时可能无法跟上重做日志生成的速度,从而导致由于这些记录被覆盖而丢失重做日志记录。The redo log archiving feature addresses this issue by sequentially writing redo log records to an archive file. 重做日志存档功能通过将重做日志记录顺序写入存档文件来解决此问题。Backup utilities can copy redo log records from the archive file as necessary, thereby avoiding the potential loss of data. 备份实用程序可以根据需要从存档文件中复制重做日志记录,从而避免潜在的数据丢失。For more information, see Redo Log Archiving.有关详细信息,请参阅重做日志存档。
The Clone Plugin.克隆插件。 As of MySQL 8.0.17, MySQL provides a clone plugin that permits cloning 从MySQL 8.0.17开始,MySQL提供了一个克隆插件,允许在本地或从远程MySQL服务器实例克隆InnoDB
data locally or from a remote MySQL server instance. InnoDB
数据。A local cloning operation stores cloned data on the same server or node where the MySQL instance runs. 本地克隆操作将克隆的数据存储在运行MySQL实例的同一服务器或节点上。A remote cloning operation transfers cloned data over the network from a donor MySQL server instance to the recipient server or node where the cloning operation was initiated.远程克隆操作通过网络将克隆数据从提供方MySQL服务器实例传输到发起克隆操作的接收方服务器或节点。
The clone plugin supports replication. 克隆插件支持复制。In addition to cloning data, a cloning operation extracts and transfers replication coordinates from the donor and applies them on the recipient, which enables using the clone plugin for provisioning Group Replication members and replicas. 除了克隆数据之外,克隆操作还从提供方提取和传输复制坐标,并将其应用于接收方,这使得可以使用克隆插件来设置组复制成员和副本。Using the clone plugin for provisioning is considerably faster and more efficient than replicating a large number of transactions. 使用克隆插件进行资源调配要比复制大量事务快得多,效率也更高。Group Replication members can also be configured to use the clone plugin as an alternative method of recovery, so that members automatically choose the most efficient way to retrieve group data from seed members.组复制成员还可以配置为使用克隆插件作为恢复的替代方法,以便成员自动选择从种子成员检索组数据的最有效方式。
For more information, see Section 5.6.7, “The Clone Plugin”, and Section 18.5.3.2, “Cloning for Distributed Recovery”.有关更多信息,请参阅第5.6.7节,“克隆插件”和第18.5.3.2节,“克隆以进行分布式恢复”。
Hash Join Optimization.哈希连接优化。 Beginning with MySQL 8.0.18, a hash join is used whenever each pair of tables in a join includes at least one equi-join condition, and no indexes apply to any join condition. 从MySQL 8.0.18开始,每当连接中的每对表至少包含一个equi连接条件,并且没有索引应用于任何连接条件时,就会使用hash连接。A hash join does not require indexes, although it can be used with indexes applying to single-table predicates only. 哈希联接不需要索引,尽管它可以与仅应用于单表谓词的索引一起使用。A hash join is more efficient in most cases than the block-nested loop algorithm. 哈希连接在大多数情况下比块嵌套循环算法更有效。Joins such as those shown here can be optimized in this manner:此处所示的连接可以通过以下方式进行优化:
SELECT * FROM t1 JOIN t2 ON t1.c1=t2.c1; SELECT * FROM t1 JOIN t2 ON (t1.c1 = t2.c1 AND t1.c2 < t2.c2) JOIN t3 ON (t2.c1 = t3.c1)
Hash joins can also be used for Cartesian products—that is, when no join condition is specified.散列联接也可以用于笛卡尔积,也就是说,当没有指定联接条件时。
You can see when the hash join optimization is being used for a particular query using 您可以使用EXPLAIN FORMAT=TREE
or EXPLAIN ANALYZE
. EXPLAIN FORMAT=TREE
或EXPLAIN ANALYZE
查看哈希连接优化何时用于特定查询。(In MySQL 8.0.20 and later, you can also use (在MySQL 8.0.20及更高版本中,还可以使用EXPLAIN
, omitting FORMAT=TREE
.)EXPLAIN
,省略FORMAT=TREE
。)
The amount of memory available to a hash join is limited by the value of 哈希联接可用的内存量受join_buffer_size
. join_buffer_size
的值限制。A hash join that requires more than this much memory is executed on disk; the number of disk files that can be used by an on-disk hash join is limited by 在磁盘上执行一个哈希连接,它需要的内存比这个多;磁盘上哈希联接可以使用的磁盘文件数受open_files_limit
.open_files_limit
的限制。
As of MySQL 8.0.19, the 从MySQL 8.0.19开始,MySQL 8.0.18中引入的hash_join
optimizer switch which was introduced in MySQL 8.0.18 no longer supported (hash_join=on still appears as part of the value of optimizer_switch, but setting it no longer has any effect). hash_join
优化器开关不再受支持(hash_join=on仍然作为optimizer_switch值的一部分出现,但是设置它不再有任何效果)。The HASH_JOIN
and NO_HASH_JOIN
optimizer hints are also no longer supported. HASH_JOIN
和NO_HASH_JOIN
优化器提示也不再受支持。The switch and the hint are both now deprecated; expect them to be removed in a future MySQL release. 开关和提示现在都被弃用了;希望在将来的MySQL版本中删除它们。In MySQL 8.0.18 and later, hash joins can be disabled using the 在MySQL 8.0.18及更高版本中,可以使用NO_BNL
optimizer switch.NO-BNL
优化器开关禁用散列联接。
In MySQL 8.0.20 and later, block nested loop is no longer used in the MySQL server, and a hash join is employed any time a block nested loop would have been used previously, even when the query contains no equi-join conditions. 在MySQL 8.0.20及更高版本中,MySQL服务器不再使用块嵌套循环,并且在以前使用块嵌套循环的任何时候都会使用哈希连接,即使查询不包含equi-join条件。This applies to inner non-equijoins, semijoins, antijoins, left outer joins, and right outer joins. 这适用于内部非等分联接、半联接、反联接、左外联接和右外联接。The block_nested_loop
flag for the optimizer_switch
system variable as well as the BNL
and NO_BNL
optimizer hints are still supported, but henceforth control use of hash joins only. optimizer_switch
系统变量的block_nested_loop
标志以及BNL
和NO_BNL
优化器提示仍受支持,但此后仅控制哈希联接的使用。In addition, both inner and outer joins (including semijoins and antijoins) can now employ batched key access (BKA), which allocates join buffer memory incrementally so that individual queries need not use up large amounts of resources that they do not actually require for resolution. 此外,内部联接和外部联接(包括半联接和反联接)现在都可以采用批处理密钥访问(BKA),它以增量方式分配联接缓冲区内存,这样单个查询就不需要占用它们实际上不需要的大量资源来解决。BKA for inner joins only is supported starting with MySQL 8.0.18.从MySQL8.0.18开始,只支持用于内部联接的BKA。
MySQL 8.0.20 also replaces the executor used in previous versions of MySQL with the iterator executor. MySQL 8.0.20还用迭代器执行器替换了MySQL以前版本中使用的执行器。This work includes replacement of the old index subquery engines that governed queries of the form 这项工作包括为未被优化为半连接的WHERE
for those value
IN (SELECT column
FROM table
WHERE ...)IN
queries which have not been optimized as semijoins, as well as queries materialized in the same form, which formerly depended on the old executor.IN
查询替换控制WHERE
形式的查询的旧的索引子查询引擎,并且查询以相同的形式具体化,以前依赖于旧的执行器。value
IN (SELECT column
FROM table
WHERE ...)
For more information and examples, see Section 8.2.1.4, “Hash Join Optimization”. 有关更多信息和示例,请参阅第8.2.1.4节,“哈希连接优化”。See also Batched Key Access Joins.另请参阅批量处理密钥访问连接。
EXPLAIN ANALYZE Statement.解释分析语句。 A new form of the EXPLAIN
statement, EXPLAIN ANALYZE
, is implemented in MySQL 8.0.18, providing expanded information about the execution of SELECT
statements in TREE
format for each iterator used in processing the query, and making it possible to compare estimated cost with the actual cost of the query. EXPLAIN
语句的一种新形式,EXPLAIN ANALYZE
在MySQL 8.0.18中实现,它以TREE
格式为处理查询时使用的每个迭代器提供了SELECT
语句执行的扩展信息,并使比较查询的估计成本和实际成本成为可能。This information includes startup cost, total cost, number of rows returned by this iterator, and the number of loops executed.此信息包括启动成本、总成本、此迭代器返回的行数以及执行的循环数。
In MySQL 8.0.21 and later, this statement also supports a 在MySQL 8.0.21及更高版本中,此语句还支持FORMAT=TREE
specifier. FORMAT=TREE
说明符。TREE
is the only supported format.TREE
是唯一受支持的格式。
See Obtaining Information with EXPLAIN ANALYZE, for more information.有关更多信息,请参阅使用解释分析获取信息。
Query cast injection.查询强制类型转换注入。 In version 8.0.18 and later, MySQL injects cast operations into the query item tree inside expressions and conditions in which the data type of the argument and the expected data type do not match. 在版本8.0.18和更高版本中,MySQL将强制转换操作注入到表达式和条件中的查询项树中,在这些表达式和条件中,参数的数据类型和预期的数据类型不匹配。This has no effect on query results or speed of execution, but makes the query as executed equivalent to one which is compliant with the SQL standard while maintaining backwards compatibility with previous releases of MySQL.这对查询结果或执行速度没有影响,但使执行时的查询相当于符合SQL标准的查询,同时保持与MySQL早期版本的向后兼容性。
Such implicit casts are now performed between temporal types (这种隐式转换现在在时态类型(DATE
, DATETIME
, TIMESTAMP
, TIME
) and numeric types (SMALLINT
, TINYINT
, MEDIUMINT
, INT
/INTEGER
, BIGINT
; DECIMAL
/NUMERIC
; FLOAT
, DOUBLE
, REAL
; BIT
) whenever they are compared using any of the standard numeric comparison operators (=
, >=
, >
, <
, <=
, <>
/!=
, or <=>
). DATE
、DATETIME
、TIMESTAMP
、TIME
)和数值类型(SMALLINT
、TINYINT
、MEDIUMINT
、INT
/INTEGER
、BIGINT
;DECIMAL
/NUMERIC
;FLOAT
、DOUBLE
、REAL
;BIT
)使用任何标准数字比较运算符(=
、>=
、>
、<
、<=
、<>
/!=
或<=>
)进行比较时。In this case, any value that is not already a 在这种情况下,任何尚未为DOUBLE
is cast as one. DOUBLE
的值都将转换为1。Cast injection is also now performed for comparisons between 现在还可以执行强制转换注入来比较DATE
or TIME
values and DATETIME
values, where the arguments are cast whenever necessary as DATETIME
.DATE
或TIME
值与DATETIME
值之间的差异,在这种情况下,只要有必要,就可以将参数强制转换为DATETIME
。
Beginning with MySQL 8.0.21, such casts are also performed when comparing string types with other types. 从MySQL8.0.21开始,在比较字符串类型和其他类型时也会执行此类强制转换。String types that are cast include 强制转换的字符串类型包括CHAR
, VARCHAR
, BINARY
, VARBINARY
, BLOB
, TEXT
, ENUM
, and SET
. CHAR
、VARCHAR
、BINARY
、VARBINARY
、BLOB
、TEXT
、ENUM
和SET
。When comparing a value of a string type with a numeric type or 将字符串类型的值与数字类型或年份进行比较时,字符串类型转换为YEAR
, the string cast is to DOUBLE
; if the type of the other argument is not FLOAT
, DOUBLE
, or REAL
, it is also cast to DOUBLE
. DOUBLE
;如果另一个参数的类型不是FLOAT
、DOUBLE
或REAL
,那么它也会被转换为DOUBLE
。When comparing a string type to a 将字符串类型与DATETIME
or TIMESTAMP
value, the string is cast is to DATETIME
; when comparing a string type with DATE
, the string is cast to DATE
.DATETIME
或TIMESTAMP
值进行比较时,字符串被转换为DATETIME
;将字符串类型与DATE
进行比较时,字符串将转换为DATE
。
It is possible to see when casts are injected into a given query by viewing the output of 可以通过查看EXPLAIN ANALYZE
, EXPLAIN FORMAT=JSON
, or, as shown here, EXPLAIN FORMAT=TREE
:EXPLAIN ANALYZE
、EXPLAIN FORMAT=JSON
或EXPLAIN FORMAT=TREE
的输出来查看何时将强制转换注入给定查询:
mysql>CREATE TABLE d (dt DATETIME, d DATE, t TIME);
Query OK, 0 rows affected (0.62 sec) mysql>CREATE TABLE n (i INT, d DECIMAL, f FLOAT, dc DECIMAL);
Query OK, 0 rows affected (0.51 sec) mysql>CREATE TABLE s (c CHAR(25), vc VARCHAR(25),
->bn BINARY(50), vb VARBINARY(50), b BLOB, t TEXT,
->e ENUM('a', 'b', 'c'), se SET('x' ,'y', 'z'));
Query OK, 0 rows affected (0.50 sec) mysql>EXPLAIN FORMAT=TREE SELECT * from d JOIN n ON d.dt = n.i\G
*************************** 1. row *************************** EXPLAIN: -> Inner hash join (cast(d.dt as double) = cast(n.i as double)) (cost=0.70 rows=1) -> Table scan on n (cost=0.35 rows=1) -> Hash -> Table scan on d (cost=0.35 rows=1) mysql>EXPLAIN FORMAT=TREE SELECT * from s JOIN d ON d.dt = s.c\G
*************************** 1. row *************************** EXPLAIN: -> Inner hash join (d.dt = cast(s.c as datetime(6))) (cost=0.72 rows=1) -> Table scan on d (cost=0.37 rows=1) -> Hash -> Table scan on s (cost=0.35 rows=1) 1 row in set (0.01 sec) mysql>EXPLAIN FORMAT=TREE SELECT * from n JOIN s ON n.d = s.c\G
*************************** 1. row *************************** EXPLAIN: -> Inner hash join (cast(n.d as double) = cast(s.c as double)) (cost=0.70 rows=1) -> Table scan on s (cost=0.35 rows=1) -> Hash -> Table scan on n (cost=0.35 rows=1) 1 row in set (0.00 sec)
Such casts can also be seen by executing 执行EXPLAIN [FORMAT=TRADITIONAL]
, in which case it is also necessary to issue SHOW WARNINGS
after executing the EXPLAIN
statement.EXPLAIN [FORMAT=TRADITIONAL]
也可以看到这种类型转换,在这种情况下,在执行EXPLAIN
语句之后还需要发出SHOW WARNINGS
。
Time zone support for TIMESTAMP and DATETIME.时区支持TIMESTAMP和DATETIME。 As of MySQL 8.0.19, the server accepts a time zone offset with inserted datetime (从MySQL 8.0.19开始,服务器接受带有插入日期时间(TIMESTAMP
and DATETIME
) values. TIMESTAMP
和DATETIME
)值的时区偏移量。This offset uses the same format as that employed when setting the 此偏移使用的格式与设置时区系统变量时使用的格式相同,只是当偏移的小时数部分小于10时需要前导零,并且不允许使用time_zone
system variable, except that a leading zero is required when the hours portion of the offset is less than 10, and '-00:00'
is not allowed. '-00:00'
。Examples of datetime literals that include time zone offsets are 包含时区偏移的日期时间文字的示例有'2019-12-11 10:40:30-05:00'
, '2003-04-14 03:30:00+10:00'
, and '2020-01-01 15:35:45+05:30'
.'2019-12-11 10:40:30-05:00'
、'2003-04-14 03:30:00+10:00'
和'2020-01-01 15:35:45+05:30'
。
Time zone offsets are not displayed when selecting datetime values.选择日期时间值时不显示时区偏移。
Datetime literals incorporating time zone offsets can be used as prepared statement parameter values.包含时区偏移量的Datetime文本可以用作准备语句参数值。
As part of this work, the value used to set the 作为这项工作的一部分,用于设置时区系统变量的值现在也被限制在time_zone
system variable is now also restricted to the range -13:59
to +14:00
, inclusive. -13:59
到+14:00
的范围内(包括两者)。(It remains possible to assign name values to (仍然可以将time_zone
such as 'EST'
, 'Posix/Australia/Brisbane'
, and 'Europe/Stockholm'
to this variable, provided that the MySQL time zone tables are loaded; see Populating the Time Zone Tables).time_zone
的名称值(如'EST'
、'Posix/Australia/Brisbane'
和'Europe/Stockholm'
分配给此变量),前提是加载了MySQL时区表;请参见填充时区表)。
For more information and examples, see Section 5.1.15, “MySQL Server Time Zone Support”, as well as Section 11.2.2, “The DATE, DATETIME, and TIMESTAMP Types”.有关更多信息和示例,请参阅第5.1.15节,“MySQL Server时区支持”,以及第11.2.2节,“日期、日期时间和时间戳类型”。
Precise information for JSON schema CHECK constraint failures.JSON模式检查约束失败的精确信息。 When using 当使用JSON_SCHEMA_VALID()
to specify a CHECK
constraint, MySQL 8.0.19 and later provides precise information about the reasons for failures of such constraints.JSON_SCHEMA_VALID()
指定CHECK
约束时,MySQL 8.0.19和更高版本提供了有关此类约束失败原因的精确信息。
For examples and more information, see JSON_SCHEMA_VALID() and CHECK constraints. 有关示例和更多信息,请参阅JSON_SCHEMA_VALID()
和检查约束。See also Section 13.1.20.6, “CHECK Constraints”.另请参阅第13.1.20.6节,“检查约束”。
Row and column aliases with ON DUPLICATE KEY UPDATE.行和列别名在重复键更新时具有。 Beginning with MySQL 8.0.19, it is possible to reference the row to be inserted, and, optionally, its columns, using aliases. 从MySQL 8.0.19开始,可以使用别名引用要插入的行,也可以引用其列。Consider the following 考虑表INSERT
statement on a table t
having columns a
and b
:t
中具有列a
和b
的以下INSERT
语句:
INSERT INTO t SET a=9,b=5 ON DUPLICATE KEY UPDATE a=VALUES(a)+VALUES(b);
Using the alias 对于新行使用别名new
for the new row, and, in some cases, the aliases m
and n
for this row's columns, the INSERT
statement can be rewritten in many different ways, some examples of which are shown here:new
,在某些情况下,对于此行的列使用别名m
和n
,可以用许多不同的方式重写INSERT
语句,其中的一些示例如下所示:
INSERT INTO t SET a=9,b=5 AS new ON DUPLICATE KEY UPDATE a=new.a+new.b; INSERT INTO t VALUES(9,5) AS new ON DUPLICATE KEY UPDATE a=new.a+new.b; INSERT INTO t SET a=9,b=5 AS new(m,n) ON DUPLICATE KEY UPDATE a=m+n; INSERT INTO t VALUES(9,5) AS new(m,n) ON DUPLICATE KEY UPDATE a=m+n;
For more information and examples, see Section 13.2.6.2, “INSERT ... ON DUPLICATE KEY UPDATE Statement”.有关更多信息和示例,请参阅第13.2.6.2节,“INSERT ... ON DUPLICATE KEY UPDATE语句”。
SQL standard explicit table clause and table value constructor.SQL标准显式表子句和表值构造函数。 Added table value constructors and explicit table clauses according to the SQL standard. 根据SQL标准添加了表值构造函数和显式表子句。These are implemented in MySQL 8.0.19, respectively, as the 它们在MySQL 8.0.19中分别实现为TABLE
statement and the VALUES
statement.TABLE
语句和VALUES
语句。
The TABLE
statement has the format TABLE
, and is equivalent to table_name
SELECT * FROM
. table_name
TABLE
语句的格式为TABLE
,相当于table_name
SELECT * FROM
。table_name
It supports 它支持ORDER BY
and LIMIT
clauses ( the latter with optional OFFSET
), but does not allow for the selection of individual table columns. ORDER BY
子句和LIMIT
子句(后者带有可选的OFFSET
),但不允许选择单个表列。TABLE
can be used anywhere that you would employ the equivalent SELECT
statement; this includes joins, unions, INSERT ... SELECT
, REPLACE
, CREATE TABLE ... SELECT
statements, and subqueries. TABLE
可以在任何使用等效SELECT
语句的地方使用;这包括JOIN
、UNION
、INSERT ... SELECT
语句、REPLACE
语句、CREATE TABLE ... SELECT
语句和子查询。For example:例如:
TABLE t1 UNION TABLE t2
is equivalent to SELECT * FROM t1 UNION SELECT * FROM t2
TABLE t1 UNION TABLE t2
等同于SELECT * FROM t1 UNION SELECT * FROM t2
CREATE TABLE t2 TABLE t1
is equivalent to CREATE TABLE t2 SELECT * FROM t1
CREATE TABLE t2 TABLE t1
等同于CREATE TABLE t2 SELECT * FROM t1
SELECT a FROM t1 WHERE b > ANY (TABLE t2)
is equivalent to SELECT a FROM t1 WHERE b > ANY (SELECT * FROM t2)
.SELECT a FROM t1 WHERE b > ANY (TABLE t2)
等同于SELECT a FROM t1 WHERE b > ANY (SELECT * FROM t2)
VALUES
can be used to supply a table value to an INSERT
, REPLACE
, or SELECT
statement, and consists of the VALUES
keyword followed by a series of row constructors (ROW()
) separated by commas. VALUES
可用于向INSERT
、REPLACE
或SELECT
语句提供表值,它由VALUES
关键字后跟一系列行构造函数(ROW()
)组成,行构造函数之间用逗号分隔。For example, the statement 例如,INSERT INTO t1 VALUES ROW(1,2,3), ROW(4,5,6), ROW(7,8,9)
provides an SQL-compliant equivalent to the MySQL-specific INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9)
. INSERT INTO t1 VALUES ROW(1,2,3), ROW(4,5,6), ROW(7,8,9)
语句提供了一个与SQL兼容的等效语句,相当于MySQL特定的INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9)
。You can also select from a 也可以像从表中选择值一样从VALUES
table value constructor just as you would a table, bearing in mind that you must supply a table alias when doing so, and use this SELECT
just as you would any other; this includes joins, unions, and subqueries.VALUES
表值构造函数中进行选择,记住这样做时必须提供表别名,并像使用任何其他方法一样使用此SELECT
;这包括联接、联合和子查询。
For more information about 有关TABLE
and VALUES
, and for examples of their use, see the following sections of this documentation:TABLE
和VALUES
的详细信息及其使用示例,请参阅本文档的以下部分:
Optimizer hints for FORCE INDEX, IGNORE INDEX.优化器提示强制索引,忽略索引。 MySQL 8.0 introduces index-level optimizer hints which serve as analogs to the traditional index hints as described in Section 8.9.4, “Index Hints”. MySQL 8.0引入了索引级优化器提示,类似于第8.9.4节,“索引提示”中描述的传统索引提示。The new hints are listed here, along with their 此处列出了新提示及其FORCE INDEX
or IGNORE INDEX
equivalents:FORCE INDEX
或IGNORE INDEX
等效项:
GROUP_INDEX
: Equivalent to :相当于FORCE INDEX FOR GROUP BY
NO_GROUP_INDEX
: Equivalent to :相当于IGNORE INDEX FOR GROUP BY
JOIN_INDEX
: Equivalent to :相当于FORCE INDEX FOR JOIN
NO_JOIN_INDEX
: Equivalent to :相当于IGNORE INDEX FOR JOIN
ORDER_INDEX
: Equivalent to :相当于FORCE INDEX FOR ORDER BY
NO_ORDER_INDEX
: Equivalent to :相当于IGNORE INDEX FOR ORDER BY
INDEX
: Same as :与GROUP_INDEX
plus JOIN_INDEX
plus ORDER_INDEX
; equivalent to FORCE INDEX
with no modifierGROUP_INDEX
加JOIN_INDEX
加JOIN_INDEX
相同;相当于没有修饰符的FORCE INDEX
NO_INDEX
: Same as :与NO_GROUP_INDEX plus
NO_JOIN_INDEX
plus NO_ORDER_INDEX
; equivalent to IGNORE INDEX
with no modifierNO_GROUP_INDEX
加NO_JOIN_INDEX
加NO_ORDER_INDEX
相同;相当于没有修饰符的IGNORE INDEX
For example, the following two queries are equivalent:例如,以下两个查询是等效的:
SELECT a FROM t1 FORCE INDEX (i_a) FOR JOIN WHERE a=1 AND b=2; SELECT /*+ JOIN_INDEX(t1 i_a) */ a FROM t1 WHERE a=1 AND b=2;
The optimizer hints listed previously follow the same basic rules for syntax and usage as existing index-level optimizer hints.前面列出的优化器提示在语法和用法方面遵循与现有索引级优化器提示相同的基本规则。
These optimizer hints are intended to replace 这些优化器提示旨在替换FORCE INDEX
and IGNORE INDEX
, which we plan to deprecate in a future MySQL release, and subsequently to remove from MySQL. FORCE INDEX
和IGNORE INDEX
,我们计划在将来的MySQL版本中不推荐使用它们,并随后从MySQL中删除它们。They do not implement a single exact equivalent for 它们没有实现一个完全等效的USE INDEX
; instead, you can employ one or more of NO_INDEX
, NO_JOIN_INDEX
, NO_GROUP_INDEX
, or NO_ORDER_INDEX
to achieve the same effect.USE INDEX
;相反,您可以使用一个或多个NO_INDEX
、NO_JOIN_INDEX
、NO_GROUP_INDEX
或NO_ORDER_INDEX
来实现相同的效果。
For further information and examples of use, see Index-Level Optimizer Hints.有关更多信息和使用示例,请参阅索引级优化器提示。
JSON_VALUE() function.函数 MySQL 8.0.21 implements a new function MySQL 8.0.21实现了一个新函数JSON_VALUE()
intended to simplify indexing of JSON
columns. JSON_VALUE()
,旨在简化JSON
列的索引。In its most basic form, it takes as arguments a JSON document and a JSON path pointing to a single value in that document, as well as (optionally) allowing you to specify a return type with the 在最基本的形式中,它将JSON文档和指向该文档中单个值的JSON路径作为参数,并且(可选)允许您使用RETURNING
keyword. RETURNING
关键字指定返回类型。JSON_VALUE(
json_doc
, path
RETURNING type
) is equivalent to this:相当于:
CAST( JSON_UNQUOTE( JSON_EXTRACT(json_doc
,path
) ) AStype
);
You can also specify 您还可以指定ON EMPTY
, ON ERROR
, or both clauses, similar to those employed with JSON_TABLE()
.ON EMPTY
子句、ON ERROR
子句或两者,类似于JSON_TABLE()
中使用的那些子句。
You can use 可以使用JSON_VALUE()
to create an index on an expression on a JSON
column like this:JSON_VALUE()
在JSON
列上的表达式上创建索引,如下所示:
CREATE TABLE t1( j JSON, INDEX i1 ( (JSON_VALUE(j, '$.id' RETURNING UNSIGNED)) ) ); INSERT INTO t1 VALUES ROW('{"id": "123", "name": "shoes", "price": "49.95"}');
A query using this expression, such as that shown here, can make use of the index:使用此表达式的查询(如图所示)可以使用索引:
SELECT name, price FROM t1 WHERE JSON_VALUE(j, '$.id' RETURNING UNSIGNED) = 123;
In many cases, this is simpler than creating a generated column from the 在许多情况下,这比从JSON
column and then creating an index on the generated column.JSON
列创建一个生成的列,然后在生成的列上创建索引要简单。
For more information and examples, see the description of 有关更多信息和示例,请参阅JSON_VALUE()
.JSON_VALUE()
的说明。
User comments and user attributes.用户评论和用户属性。 MySQL 8.0.21 introduces the ability to set user comments and user attributes when creating or updating user accounts. MySQL 8.0.21引入了在创建或更新用户帐户时设置用户注释和用户属性的功能。A user comment consists of arbitrary text passed as the argument to a 用户注释由作为参数传递给COMMENT
clause used with a CREATE USER
or ALTER USER
statement. CREATE USER
或ALTER USER
语句所用的COMMENT
子句的任意文本组成。A user attribute consists of data in the form of a JSON object passed as the argument to an 用户属性由JSON对象形式的数据组成,JSON对象作为参数传递给与这两条语句一起使用的ATTRIBUTE
clause used with either of these two statements. ATTRIBUTE
子句。The attribute can contain any valid key-value pairs in JSON object notation. 该属性可以包含JSON对象表示法中的任何有效键值对。Only one of 在单个COMMENT
or ATTRIBUTE
can be used in a single CREATE USER
or ALTER USER
statement.CREATE USER
或ALTER USER
语句中只能使用COMMENT
或ATTRIBUTE
中的一个。
User comments and user attributes are stored together internally as a JSON object, the comment text as the value of an element having 用户注释和用户属性在内部存储为一个JSON对象,注释文本作为一个元素的值,该元素的键是comment
as its key. comment
。This information can be retrieved from the 可以从ATTRIBUTE
column of the INFORMATION_SCHEMA.USER_ATTRIBUTES
table; since it is in JSON format, you can use MySQL's JSON function and operators to parse its contents (see Section 12.18, “JSON Functions”). INFORMATION_SCHEMA.USER_ATTRIBUTES
表的ATTRIBUTE
列检索此信息;因为它是JSON格式的,所以可以使用MySQL的JSON函数和操作符来解析它的内容(请参阅第12.18节,“JSON函数”)。Successive changes to the user attribute are merged with its current value as when using the 当使用JSON_MERGE_PATCH()
function.JSON_MERGE_PATCH()
函数时,对用户属性的连续更改将与其当前值合并。
Example:例子:
mysql>CREATE USER 'mary'@'localhost' COMMENT 'This is Mary Smith\'s account';
Query OK, 0 rows affected (0.33 sec) mysql>ALTER USER 'mary'@'localhost'
-≫ATTRIBUTE '{"fname":"Mary", "lname":"Smith"}';
Query OK, 0 rows affected (0.14 sec) mysql>ALTER USER 'mary'@'localhost'
-≫ATTRIBUTE '{"email":"mary.smith@example.com"}';
Query OK, 0 rows affected (0.12 sec) mysql>SELECT
->USER,
->HOST,
->ATTRIBUTE->>"$.fname" AS 'First Name',
->ATTRIBUTE->>"$.lname" AS 'Last Name',
->ATTRIBUTE->>"$.email" AS 'Email',
->ATTRIBUTE->>"$.comment" AS 'Comment'
->FROM INFORMATION_SCHEMA.USER_ATTRIBUTES
->WHERE USER='mary' AND HOST='localhost'\G
*************************** 1. row *************************** USER: mary HOST: localhost First Name: Mary Last Name: Smith Email: mary.smith@example.com Comment: This is Mary Smith's account 1 row in set (0.00 sec)
For more information and examples, see Section 13.7.1.3, “CREATE USER Statement”, Section 13.7.1.1, “ALTER USER Statement”, and Section 26.3.46, “The INFORMATION_SCHEMA USER_ATTRIBUTES Table”.有关更多信息和示例,请参阅第13.7.1.3节,“CREATE USER语句”、第13.7.1.1节,“ALTER USER语句”和第26.3.46节,“信息架构用户属性表”。
New optimizer_switch flags.新的optimizer_switch标志。 MySQL 8.0.21 adds two new flags for the MySQL 8.0.21为optimizer_switch
system variable, as described in the following list:optimizer_switch
系统变量添加了两个新标志,如下表所示:
prefer_ordering_index
flag标志
By default, MySQL attempts to use an ordered index for any 默认情况下,每当优化器确定这将导致更快的执行时,MySQL都会尝试对任何具有ORDER BY
or GROUP BY
query that has a LIMIT
clause, whenever the optimizer determines that this would result in faster execution. LIMIT
子句的ORDER BY
或GROUP BY
查询使用有序索引。Because it is possible in some cases that choosing a different optimization for such queries actually performs better, it is now possible to disable this optimization by setting the 因为在某些情况下,为这样的查询选择不同的优化实际上执行得更好,所以现在可以通过将prefer_ordering_index
flag to off
.prefere_ordering_index
标志设置为off
来禁用此优化。
The default value for this flag is 此标志的默认值为on
.on
。
subquery_to_derived
flag标志
When this flag is set to 当此标志设置为on
, the optimizer transforms eligible scalar subqueries into joins on derived tables. on
时,优化器将符合条件的标量子查询转换为派生表上的联接。For example, the query 例如,查询SELECT * FROM t1 WHERE t1.a > (SELECT COUNT(a) FROM t2)
is rewritten as SELECT t1.a FROM t1 JOIN ( SELECT COUNT(t2.a) AS c FROM t2 ) AS d WHERE t1.a > d.c
.SELECT * FROM t1 WHERE t1.a > (SELECT COUNT(a) FROM t2)
被重写为SELECT t1.a FROM t1 JOIN ( SELECT COUNT(t2.a) AS c FROM t2 ) AS d WHERE t1.a > d.c
。
This optimization can be applied to a subquery which is part of a 这种优化可以应用于SELECT
, WHERE
, JOIN
, or HAVING
clause; contains one or more aggregate functions but no GROUP BY
clause; is not correlated; and does not use any nondeterministic functions.SELECT
、WHERE
、JOIN
或HAVING
子句的子查询;包含一个或多个聚合函数,但没有GROUP BY
子句;不相关;不使用任何不确定函数。
The optimization can also be applied to a table subquery which is the argument to 优化还可以应用于表子查询,该表子查询是IN
, NOT IN
, EXISTS
, or NOT EXISTS
, and which does not contain a GROUP BY
. IN
、NOT IN
、EXISTS
或NOT EXISTS
的参数,并且不包含GROUP BY
。For example, the query 例如,查询SELECT * FROM t1 WHERE t1.b < 0 OR t1.a IN (SELECT t2.a + 1 FROM t2)
is rewritten as SELECT a, b FROM t1 LEFT JOIN (SELECT DISTINCT 1 AS e1, t2.a AS e2 FROM t2) d ON t1.a + 1 = d.e2 WHERE t1.b < 0 OR d.e1 IS NOT NULL
.SELECT * FROM t1 WHERE t1.b < 0 OR t1.a IN (SELECT t2.a + 1 FROM t2)
被重写为SELECT a, b FROM t1 LEFT JOIN (SELECT DISTINCT 1 AS e1, t2.a AS e2 FROM t2) d ON t1.a + 1 = d.e2 WHERE t1.b < 0 OR d.e1 IS NOT NULL
。
Starting with MySQL 8.0.24, this optimization can also be applied to a correlated scalar subquery by applying an extra grouping to it, and then an outer join on the lifted predicate. 从MySQL 8.0.24开始,这种优化还可以应用于相关标量子查询,方法是对其应用额外的分组,然后在提升的谓词上应用外部连接。For example, a query such as 例如,诸如SELECT * FROM t1 WHERE (SELECT a FROM t2 WHERE t2.a=t1.a) > 0
can be rewritten as SELECT t1.* FROM t1 LEFT OUTER JOIN (SELECT a, COUNT(*) AS ct FROM t2 GROUP BY a) AS derived ON t1.a = derived.a WHERE derived.a > 0
. SELECT * FROM t1 WHERE (SELECT a FROM t2 WHERE t2.a=t1.a) > 0
的查询可被重写为SELECT t1.* FROM t1 LEFT OUTER JOIN (SELECT a, COUNT(*) AS ct FROM t2 GROUP BY a) AS derived ON t1.a = derived.a WHERE derived.a > 0
。MySQL performs a cardinality check to make sure that the subquery does not return more than one row (MySQL执行基数检查以确保子查询不会返回多行(ER_SUBQUERY_NO_1_ROW
). ER_SUBQUERY_NO_1_ROW
)。See Section 13.2.11.7, “Correlated Subqueries”, for more information.有关更多信息,请参阅第13.2.11.7节,“相关子查询”。
This optimization is normally disabled, since it does not yield a noticeable performance benefit in most cases; the flag is set to 这种优化通常是禁用的,因为在大多数情况下它不会产生明显的性能优势;默认情况下,该标志设置为off
by default.off
。
For more information, see Section 8.9.2, “Switchable Optimizations”. 有关更多信息,请参阅第8.9.2节,“可切换优化”。See also Section 8.2.1.19, “LIMIT Query Optimization”, Section 8.2.2.1, “Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations”, and Section 8.2.2.4, “Optimizing Derived Tables, View References, and Common Table Expressions with Merging or Materialization”.另请参阅第8.2.1.19节,“限制查询优化”、第8.2.2.1节,“使用半联接转换优化IN和EXISTS子查询谓词”和第8.2.2.4节,“使用合并或物化优化派生表、视图引用和公共表表达式”。
XML enhancements.XML增强功能。 As of MySQL 8.0.21, the 从MySQL 8.0.21开始,LOAD XML
statement now supports CDATA
sections in the XML to be imported.LOAD XML
语句现在支持导入XML中的CDATA
部分。
Casting to the YEAR type now supported.现在支持转换为年份类型。 Beginning with MySQL 8.0.22, the server allows casting to 从MySQL8.0.22开始,服务器允许YEAR
. YEAR
进行强制转换。Both the CAST()
and CONVERT()
functions support single-digit, two-digit, and four-digit YEAR
values. CAST()
和CONVERT()
函数都支持一位数、两位数和四位数的年份值。For one-digit and two-digit values, the allowed range is 0-99. 对于一位数和两位数的值,允许的范围是0-99。Four-digit values must be in the range 1901-2155. 四位数的值必须在1901-2155之间。YEAR
can also be used as the return type for the JSON_VALUE()
function; this function supports four-digit years only.YEAR
也可以用作JSON_VALUE()
函数的返回类型;此函数仅支持四位数年份。
String, time-and-date, and floating-point values can all be cast to 字符串、时间和日期以及浮点值都可以转换为YEAR
. YeAR
。Casting of 不支持将GEOMETRY
values to YEAR
is not supported.GEOMETRY
值强制转换为YEAR
。
For more information, including conversion rules, see the description of the 有关更多信息(包括转换规则),请参阅CONVERT()
function.CONVERT()
函数的说明。
Retrieval of TIMESTAMP values as UTC.以UTC格式检索时间戳值。 MySQL 8.0.22 and later supports conversion of a MySQL 8.0.22及更高版本支持在检索时将TIMESTAMP
column value from the system time zone to a UTC DATETIME
on retrieval, using CAST(
, where the specifier is one of value
AT TIME ZONE specifier
AS DATETIME)[INTERVAL] '+00:00'
or 'UTC'
. TIMESTAMP
列值从系统时区转换为UTCDATETIME
,使用CAST(
,其中说明符为value
AT TIME ZONE specifier
AS DATETIME)[INTERVAL] '+00:00'
或'UTC'
之一。The precision of the 如果需要,可以将强制转换返回的DATETIME
value returned by the cast can be specified up to 6 decimal places, if desired. DATETIME
值的精度指定为最多6位小数。The 此构造不支持ARRAY
keyword is not supported with this construct.ARRAY
关键字。
还支持使用时区偏移量插入到表中的TIMESTAMP
values inserted into a table using a timezone offset are also supported. TIMESTAMP
值。Use of AT TIME ZONE
is not supported for CONVERT()
or any other MySQL function or construct.CONVERT()
或任何其他MySQL函数或构造都不支持使用AT TIME ZONE
。
For further information and examples, see the description of the 有关更多信息和示例,请参见CAST()
function.CAST()
函数的说明。
Dump file output synchronization.转储文件输出同步。 MySQL 8.0.22 and later supports periodic synchronization when writing to files by MySQL 8.0.22及更高版本支持SELECT INTO DUMPFILE
and SELECT INTO OUTFILE
statements. SELECT INTO DUMPFILE
语句和SELECT INTO OUTFILE
语句写入文件时的定期同步。This can be enabled by setting the 这可以通过将select_into_disk_sync
system variable to ON
; the size of the write buffer is determined by the value set for select_into_buffer_size
; the default is 131072 (217) bytes.select_into_disk_sync
系统变量设置为ON
来启用;写入缓冲区的大小由select_into_buffer_size
设置的值决定;默认值为131072(217)字节。
In addition, an optional delay following synchronization to disk can be set using 此外,同步到磁盘后的可选延迟可以使用select_into_disk_sync_delay
; the default is no delay (0 milliseconds).select_into_disk_sync_delay
设置;默认值为无延迟(0毫秒)。
For more information, see the descriptions of the variables referenced previously in this item.有关更多信息,请参阅本项目前面引用的变量说明。
Single preparation of statements.单独编制报表。 As of MySQL 8.0.22, a prepared statement is prepared a single time, rather than once each time it is executed. 从MySQL 8.0.22开始,prepared语句只准备一次,而不是每次执行一次。This is done when executing 这是在执行PREPARE
. PREPARE
时完成的。This is also true for any statement inside a stored procedure; the statement is prepared once, when the stored procedure is first executed.对于存储过程中的任何语句也是如此;当存储过程第一次执行时,语句准备一次。
One result of this change is that the fashion in which dynamic parameters used in prepared statements are resolved is also changed in the ways listed here:这种变化的一个结果是,已准备语句中使用的动态参数的解析方式也发生了变化,如下所示:
A prepared statement parameter is assigned a data type when the statement is prepared; the type persists for each subsequent execution of the statement (unless the statement is reprepared; see following).准备语句时,为准备语句参数分配数据类型;对于语句的每次后续执行,类型都会保持不变(除非重新编写语句;见下文)。
Using a different data type for a given parameter or user variable within a prepared statement for executions of the statement subsequent to the first execution may cause the statement to be reprepared; for this reason, it is advisable to use the same data type for a given parameter when re-executing a prepared statement.在准备好的语句中为给定参数或用户变量使用不同的数据类型,以便在第一次执行之后执行该语句,可能会导致该语句被重新准备;因此,在重新执行准备好的语句时,建议对给定参数使用相同的数据类型。
The following constructs employing window functions are no longer accepted, in order to align with the SQL standard:为了与SQL标准保持一致,不再接受使用窗口函数的以下构造:
LEAD(
expr
, nn
) and 和LAG(
expr
, nn
), where ,其中nn
is a negative numbernn
是负数
This facilitates greater compliance with the SQL standard. 这有助于更好地遵守SQL标准。See the individual function descriptions for further details.有关详细信息,请参见各个功能说明。
A user variable referenced within a prepared statement now has its data type determined when the statement is prepared; the type persists for each subsequent execution of the statement.准备好的语句中引用的用户变量现在在准备语句时已确定其数据类型;对于语句的每次后续执行,该类型都会保持不变。
A user variable referenced by a statement occurring within a stored procedure now has its data type determined the first time the statement is executed; the type persists for any subsequent invocation of the containing stored procedure.存储过程中发生的语句引用的用户变量现在在第一次执行该语句时就确定了其数据类型;该类型将持续存在,以供后续调用包含的存储过程时使用。
When executing a prepared statement of the form 在执行格式为SELECT
, passing an integer value expr1
, expr2
, ... FROM table
ORDER BY ?N
for the parameter no longer causes ordering of the results by the N
th expression in the select list; the results are no longer ordered, as is expected with ORDER BY
.constant
SELECT
的准备语句时,为参数传递整数值expr1
, expr2
, ... FROM table
ORDER BY ?N
不再导致结果按选择列表中的第N
个表达式排序;结果不再是有序的,这与ORDER BY
所期望的一样。constant
Preparing a statement used as a prepared statement or within a stored procedure only once enhances the performance of the statement, since it negates the added cost of repeated preparation. 只准备一次用作已准备语句或在存储过程中使用的语句就可以提高语句的性能,因为这样可以抵消重复准备所增加的成本。Doing so also avoids possible multiple rollbacks of preparation structures, which has been the source of numerous issues in MySQL.这样做还可以避免可能的准备结构的多次回滚,这一直是MySQL中许多问题的根源。
For more information, see Section 13.5.1, “PREPARE Statement”.有关更多信息,请参阅第13.5.1节,“PREPARE语句”。
RIGHT JOIN as LEFT JOIN handling.右连接作为左连接处理。 As of MySQL 8.0.22, the server handles all instances of 从MySQL 8.0.22开始,服务器将RIGHT JOIN
internally as LEFT JOIN
, eliminating a number of special cases in which a complete conversion was not performed at parse time.RIGHT JOIN
的所有实例作为LEFT JOIN
在内部处理,消除了一些在解析时没有执行完全转换的特殊情况。
Derived condition pushdown optimization.导出条件下推优化。 MySQL 8.0.22 (and later) implements derived condition pushdown for queries having materialized derived tables. MySQL8.0.22(及更高版本)为具有物化派生表的查询实现派生条件下推。For a query such as 对于SELECT * FROM (SELECT i, j FROM t1) AS dt WHERE i >
, it is now possible in many cases to push the the outer constant
WHERE
condition down to the derived table, in this case resulting in SELECT * FROM (SELECT i, j FROM t1 WHERE i >
.constant
) AS dtSELECT * FROM (SELECT i, j FROM t1) AS dt WHERE i >
之类的查询,在很多情况下现在能够将外部的constant
WHERE
条件下推到派生表,在这种情况下导致SELECT * FROM (SELECT i, j FROM t1 WHERE i >
。constant
) AS dt
Previously, if the derived table was materialized and not merged, MySQL materialized the entire table, then qualified the rows with the 以前,如果派生表是具体化的而不是合并的,MySQL具体化整个表,然后用WHERE
condition. WHERE
条件限定行。Moving the 使用派生条件下推优化将WHERE
condition into the subquery using the derived condition pushdown optimization can often reduce the number of rows must be be processed, which can decrease the time needed to execute the query.WHERE
条件移动到子查询中通常可以减少必须处理的行数,从而减少执行查询所需的时间。
An outer 当派生表不使用任何聚合或窗口函数时,可以将外部WHERE
condition can be pushed down directly to a materialized derived table when the derived table does not use any aggregate or window functions. WHERE
条件直接下推到具体化的派生表。When the derived table has a 当派生表具有GROUP BY
and does not use any window functions, the outer WHERE
condition can be pushed down to the derived table as a HAVING
condition. GROUP BY
且不使用任何窗口函数时,可以将外部WHERE
条件作为HAVING
条件下推到派生表。The 当派生表使用窗口函数和窗口函数的WHERE
condition can also be pushed down when the derived table uses a window function and the outer WHERE
references columns used in the window function's PARTITION
clause.PARTITION
子句中使用的外部WHERE
引用列时,WHERE
条件也可以向下推。
Derived condition pushdown is enabled by default, as indicated by the 默认情况下启用派生条件下推,如optimizer_switch
system variable's derived_condition_pushdown
flag. optimizer_switch
系统变量的derived_condition_pushdown
标志所示。The flag, added in MySQL 8.0.22, is set to MySQL 8.0.22中添加的标志,默认设置为on;要禁用对特定查询的优化,可以使用on
by default; to disable the optimization for a specific query, you can use the NO_DERIVED_CONDITION_PUSHDOWN
optimizer hint (also added in MySQL 8.0.22). NO_DERIVED_CONDITION_PUSHDOWN
优化器提示(也在MySQL 8.0.22中添加)。If the optimization is disabled due to 如果由于derived_condition_pushdown
being set to off
, you can enable it for a given query using DERIVED_CONDITION_PUSHDOWN
.derived_condition_pushdown
设置为off
而禁用了优化,则可以使用DERIVED_CONDITION_PUSHDOWN
为给定查询启用它。
The derived condition pushdown optimization cannot be employed for a derived table that contains a 派生条件下推优化不能用于包含UNION
or LIMIT
clause. UNION
或LIMIT
子句的派生表。In addition, a condition that itself uses a subquery cannot be pushed down, and a 此外,不能将本身使用子查询的条件下推,也不能将WHERE
condition cannot be pushed down to a derived table that is also an inner table of an outer join. WHERE
条件下推到同时也是外部联接的内部表的派生表中。For additional information and examples, see Section 8.2.2.5, “Derived Condition Pushdown Optimization”.有关更多信息和示例,请参阅第8.2.2.5节,“导出条件下推优化”。
Non-locking reads on MySQL grant tables.MySQL授权表上的非锁定读取。 As of MySQL 8.0.22, to permit concurrent DML and DDL operations on MySQL grant tables, read operations that previously acquired row locks on MySQL grant tables are executed as non-locking reads.从MySQL 8.0.22开始,为了允许在MySQL grant表上同时执行DML和DDL操作,以前在MySQL grant表上获得行锁的读取操作将作为非锁定读取执行。
The operations that are now performed as non-locking reads on MySQL grant tables include:现在在MySQL grant表上作为非锁定读取执行的操作包括:
SELECT
statements and other read-only statements that read data from grant tables through join lists and subqueries, including SELECT ... FOR SHARE
statements, using any transaction isolation level.SELECT
语句和其他只读语句通过联接列表和子查询从grant表中读取数据,包括SELECT ... FOR SHARE
语句,使用任何事务隔离级别。
DML operations that read data from grant tables (through join lists or subqueries) but do not modify them, using any transaction isolation level.使用任何事务隔离级别从授权表(通过联接列表或子查询)读取数据但不修改它们的DML操作。
For additional information, see Grant Table Concurrency.有关其他信息,请参阅授权表并发。
The following features are deprecated in MySQL 8.0 and may be removed in a future series. 以下特性在MySQL8.0中已被弃用,在以后的系列中可能会被删除。Where alternatives are shown, applications should be updated to use them.如果显示了替代方案,则应更新应用程序以使用它们。
For applications that use features deprecated in MySQL 8.0 that have been removed in a higher MySQL series, statements may fail when replicated from a MySQL 8.0 source to a higher-series replica, or may have different effects on source and replica. 对于使用MySQL8.0中不推荐的功能的应用程序,如果这些功能已在较高的MySQL8系列中删除,则当从MySQL8.0源复制到较高的系列副本时,语句可能会失败,或者可能对源和副本有不同的影响。To avoid such problems, applications that use features deprecated in 8.0 should be revised to avoid them and use alternatives when possible.为避免此类问题,应修改使用8.0中不推荐的功能的应用程序,以避免这些功能,并尽可能使用替代功能。
The 不推荐使用utf8mb3
character set is deprecated. Please use utf8mb4
instead.utf8mb3
字符集。请改用utf8mb4
。
Because 因为caching_sha2_password
is the default authentication plugin in MySQL 8.0 and provides a superset of the capabilities of the sha256_password
authentication plugin, sha256_password
is deprecated; expect it to be removed in a future version of MySQL. caching_sha2_password
是MySQL 8.0中的默认身份验证插件,并且提供了sha256_password
身份验证插件功能的超集,所以不推荐使用sha256_password
;希望在MySQL的未来版本中删除它。MySQL accounts that authenticate using 使用sha256_password
should be migrated to use caching_sha2_password
instead.sha256_password
进行身份验证的MySQL帐户应该迁移为使用caching_sha2_password
。
The validate_password
plugin has been reimplemented to use the component infrastructure. validate_password
插件已被重新实现以使用组件基础结构。The plugin form of validate_password
is still available but is now deprecated; expect it to be removed in a future version of MySQL. validate_password
的插件形式仍然可用,但现在已被弃用;希望在MySQL的未来版本中删除它。MySQL installations that use the plugin should make the transition to using the component instead. 使用插件的MySQL安装应该转换为使用组件。See Section 6.4.3.3, “Transitioning to the Password Validation Component”.请参阅第6.4.3.3节,“转换到密码验证组件”。
The ENGINE
clause for the ALTER TABLESPACE
and DROP TABLESPACE
statements is deprecated.ALTER TABLESPACE
语句和DROP TABLESPACE
语句的ENGINE
子句已弃用。
The SQL模式PAD_CHAR_TO_FULL_LENGTH
SQL mode is deprecated.PAD_CHAR_TO_FULL_LENGTH
被建议弃用了。
对于AUTO_INCREMENT
support is deprecated for columns of type FLOAT
and DOUBLE
(and any synonyms). FLOAT
和DOUBLE
(以及任何同义词)类型的列,不推荐使用自动增量支持。Consider removing the 考虑从这些列中删除AUTO_INCREMENT
attribute from such columns, or convert them to an integer type.AUTO_INCREMENT
属性,或将它们转换为整数类型。
The 对于UNSIGNED
attribute is deprecated for columns of type FLOAT
, DOUBLE
, and DECIMAL
(and any synonyms). FLOAT
、DOUBLE
和DECIMAL
(以及任何同义词)类型的列,不推荐使用UNSIGNED
属性。Consider using a simple 考虑使用一个简单的CHECK
constraint instead for such columns.CHECK
约束来代替这样的列。
FLOAT(
and M
,D
)DOUBLE(
syntax to specify the number of digits for columns of type M
,D
)FLOAT
and DOUBLE
(and any synonyms) is a nonstandard MySQL extension. FLOAT(
语法M
,D
)DOUBLE(
语法指定M
,D
)FLOAT
和DOUBLE
类型的列(以及任何同义词)的位数是一个非标准的MySQL扩展。This syntax is deprecated.此语法已弃用。
The 对于数字数据类型,ZEROFILL
attribute is deprecated for numeric data types, as is the display width attribute for integer data types. ZEROFILL
属性不受欢迎,对于整数数据类型,显示宽度属性也不受欢迎。Consider using an alternative means of producing the effect of these attributes. 考虑使用一种替代方法来产生这些属性的效果。For example, applications could use the 例如,应用程序可以使用LPAD()
function to zero-pad numbers up to the desired width, or they could store the formatted numbers in CHAR
columns.LPAD()
函数将填充数字归零到所需的宽度,也可以将格式化的数字存储在CHAR
列中。
For string data types, the 对于字符串数据类型,BINARY
attribute is a nonstandard MySQL extension that is shorthand for specifying the binary (_bin
) collation of the column character set (or of the table default character set if no column character set is specified). BINARY
属性是一个非标准的MySQL扩展,它是指定列字符集(如果未指定列字符集,则为表默认字符集)的二进制(_bin
)排序规则的缩写。In MySQL 8.0, this nonstandard use of 在MySQL 8.0中,BINARY
is ambiguous because the utf8mb4
character set has multiple _bin
collations, so the BINARY
attribute is deprecated; expect support for it to be removed in a future version of MySQL. BINARY
的这种非标准用法是不明确的,因为utf8mb4
字符集有多个_bin
排序规则,所以BINARY
属性不受欢迎;在MySQL的未来版本中,对它的支持可能会被删除。Applications should be adjusted to use an explicit 应用程序应该调整为使用显式的_bin
collation instead._bin
排序规则。
The use of 使用BINARY
to specify a data type or character set remains unchanged.BINARY
指定数据类型或字符集保持不变。
The nonstandard C-style 非标准C样式的&&
, ||
, and !
operators that are synonyms for the standard SQL AND
, OR
, and NOT
operators, respectively, are deprecated. &&
、||
,还有!
分别作为标准SQLAND
、OR
和NOT
运算符同义词的运算符将被弃用。Applications that use the nonstandard operators should be adjusted to use the standard operators.使用非标准运算符的应用程序应调整为使用标准运算符。
Use of 除非启用了||
is deprecated unless the PIPES_AS_CONCAT
SQL mode is enabled. PIPES_AS_CONCAT
SQL模式,否则不推荐使用||
。In that case, 在这种情况下,||
signifies the SQL-standard string concatenation operator).||
表示SQL标准字符串连接运算符)。
The 不推荐使用JSON_MERGE()
function is deprecated. JSON_MERGE()
函数。Use 请改用JSON_MERGE_PRESERVE()
instead.JSON_MERGE_PRESERVE()
。
The 不推荐使用SQL_CALC_FOUND_ROWS
query modifier and accompanying FOUND_ROWS()
function are deprecated. SQL_CALC_FOUND_ROWS
查询修饰符和附带的FOUND_ROWS()
函数。See the 有关替代策略的信息,请参阅FOUND_ROWS()
description for information about an alternative strategy.find_ROWS()
说明。
Support for 从MySQL8.0.13开始,不推荐支持TABLESPACE = innodb_file_per_table
and TABLESPACE = innodb_temporary
clauses with CREATE TEMPORARY TABLE
is deprecated as of MySQL 8.0.13.TABLESPACE = innodb_file_per_table
子句和TABLESPACE = innodb_temporary
子句配合CREATE TEMPORARY TABLE
。
For 对于SELECT
statements, use of an INTO
clause after FROM
but not at the end of the SELECT
is deprecated as of MySQL 8.0.20. SELECT
语句,从MySQL8.0.20开始,不推荐在FROM
后面而不是SELECT
末尾使用INTO
子句。It is preferred to place the 最好将INTO
at the end of the statement.INTO
放在语句末尾。
For 对于UNION
statements, these two variants containing INTO
are deprecated as of MySQL 8.0.20:UNION
语句,从MySQL 8.0.20开始,这两个包含INTO
的变体就不再推荐了:
In the trailing query block of a query expression, use of 在查询表达式的尾部查询块中,在INTO
before FROM
.FROM
前面使用INTO
。
In a parenthesized trailing block of a query expression, use of 在查询表达式的带圆括号的尾部块中,使用INTO
, regardless of its position relative to FROM
.INTO
,而不考虑其相对于FROM
的位置。
See Section 13.2.10.1, “SELECT ... INTO Statement”, and Section 13.2.10.3, “UNION Clause”.请参阅第13.2.10.1节,“SELECT ... INTO 语句”和第13.2.10.3节,“UNION子句”。
从MySQL8.0.23开始,不推荐使用FLUSH HOSTS
is deprecated as of MySQL 8.0.23. FLUSH HOSTS
。Instead, truncate the Performance Schema 而是截断性能架构host_cache
table:host_cache
表:
TRUNCATE TABLE performance_schema.host_cache;
The TRUNCATE TABLE
operation requires the DROP
privilege for the table.TRUNCATE TABLE
操作需要表的DROP
权限。
The mysql_upgrade client is deprecated because its capabilities for upgrading the system tables in the 不推荐使用mysql_upgrade客户端,因为它升级mysql
system schema and objects in other schemas have been moved into the MySQL server. mysql
系统模式中的系统表和其他模式中的对象的功能已被移到MySQL服务器中。See Section 2.11.3, “What the MySQL Upgrade Process Upgrades”.请参阅第2.11.3节,“MySQL升级过程升级了什么”。
The 不推荐使用--no-dd-upgrade
server option is deprecated. --no-dd-upgrade
服务器选项。It is superseded by the 它被--upgrade
option, which provides finer control over data dictionary and server upgrade behavior.--upgrade
选项取代,后者提供了对数据字典和服务器升级行为的更精细的控制。
The mysql_upgrade_info
file, which is created data directory and used to store the MySQL version number, is deprecated; expect it to be removed in a future version of MySQL.mysql_upgrade_info
文件创建于数据目录,用于存储MySQL版本号,不推荐使用;希望在MySQL的未来版本中删除它。
The relay_log_info_file
system variable and --master-info-file
option are deprecated. relay_log_info_file
系统变量和--master-info-file
选项已弃用。Previously, these were used to specify the name of the relay log info log and source info log when 以前,当设置relay_log_info_repository=FILE
and master_info_repository=FILE
were set, but those settings have been deprecated. relay_log_info_repository=FILE
和master_info_repository=FILE
时,它们用于指定中继日志信息日志和源信息日志的名称,但这些设置已被弃用。The use of files for the relay log info log and source info log has been superseded by crash-safe replica tables, which are the default in MySQL 8.0.中继日志信息日志和源信息日志文件的使用已经被崩溃安全副本表所取代,这是MySQL 8.0中的默认值。
The max_length_for_sort_data
system variable is now deprecated due to optimizer changes that make it obsolete and of no effect.max_length_for_sort_data
系统变量现在已被弃用,因为优化器的更改使其过时且无效。
These legacy parameters for compression of connections to the server are deprecated: The 不推荐使用这些用于压缩到服务器的连接的旧参数:--compress
client command-line option; the MYSQL_OPT_COMPRESS
option for the mysql_options()
C API function; the slave_compressed_protocol
system variable. --compress
客户端命令行选项;MYSQL_options()
C API函数的MYSQL_OPT_COMPRESS
选项;slave_compressed_protocol
系统变量。For information about parameters to use instead, see Section 4.2.8, “Connection Compression Control”.有关要使用的参数的信息,请参阅第4.2.8节,“连接压缩控制”。
Use of the 不赞成使用MYSQL_PWD
environment variable to specify a MySQL password is deprecated.MYSQL_PWD
环境变量指定MYSQL密码。
Use of 使用VALUES()
to access new row values in INSERT ... ON DUPLICATE KEY UPDATE
is deprecated as of MySQL 8.0.20. VALUES()
访问INSERT ... ON DUPLICATE KEY UPDATE
中的新行值从MySQL 8.0.20开始不推荐使用。Use aliases for the new row and columns, instead.请为新行和新列改用别名。
Because specifying 因为在调用ON ERROR
before ON EMPTY
when invoking JSON_TABLE()
is counter to the SQL standard, this syntax is now deprecated in MySQL. JSON_TABLE()
时在ON EMPTY
前面指定ON ERROR
与SQL标准背道而驰,所以MySQL现在不赞成使用这种语法。Beginning with MySQL 8.0.20, the server prints a warning whenever you attempt to do so. 从MySQL 8.0.20开始,每当您尝试这样做时,服务器都会打印一条警告。When specifying both of these clauses in a single 在单个JSON_TABLE()
invocation, make sure that ON EMPTY
is used first.JSON_TABLE()
调用中指定这两个子句时,请确保首先使用ON EMPTY
。
Columns with index prefixes have never been supported as part of a table's partitioning key; previously, these were allowed when creating, altering, or upgrading partitioned tables but were excluded by the table's partitioning function, and no warning that this had occurred was issued by the server. 带有索引前缀的列从未被支持作为表分区键的一部分;以前,在创建、更改或升级分区表时,这些是允许的,但被表的分区函数排除在外,并且服务器不会发出发生这种情况的警告。This permissive behavior is now deprecated, and subject to removal in a future version of MySQL in which using any such columns in the partitioning key causes the 这种允许的行为现在已经被弃用,并且在MySQL的未来版本中可能会被删除,在将来的版本中,在分区键中使用任何这样的列都会导致其中的CREATE TABLE
or ALTER TABLE
statement in they occur to be rejected.CREATE TABLE
或ALTER TABLE
语句被拒绝。
As of MySQL 8.0.21, whenever columns using index prefixes are specified as part of the partitioning key, a warning is generated for each such column. 从MySQL8.0.21开始,每当使用索引前缀的列被指定为分区键的一部分时,就会为每个这样的列生成一个警告。Whenever a 每当CREATE TABLE
or ALTER TABLE
statement is rejected because all columns in the proposed partitioning key would have index prefixes, the resulting error now provides the exact reason for the rejection. CREATE TABLE
或ALTER TABLE
语句因为建议的分区键中的所有列都有索引前缀而被拒绝时,现在产生的错误提供了拒绝的确切原因。In either instance, this includes cases in which the columns used in the partitioning function are defined implicitly as those in the table's primary key by employing an empty 在任何一种情况下,这都包括这样的情况:通过使用空PARTITION BY KEY()
clause.PARTITION BY KEY()
子句,将分区函数中使用的列隐式定义为表主键中的列。
For more information and examples, see Column index prefixes not supported for key partitioning.有关更多信息和示例,请参阅键分区不支持的列索引前缀。
The InnoDB memcached plugin is deprecated as of MySQL 8.0.22; expect support for it to be removed in a future version of MySQL.InnoDB memcached插件从MySQL8.0.22开始被弃用;在MySQL的未来版本中,对它的支持可能会被删除。
The 从MySQL8.0.26开始,temptable_use_mmap
variable is now deprecated as of MySQL 8.0.26; expect support for it to be removed in a future version of MySQL.temptable_use_mmap
变量现在已经被弃用了;在MySQL的未来版本中,对它的支持可能会被删除。
The following items are obsolete and have been removed in MySQL 8.0. 以下项目已过时,并已在MySQL 8.0中删除。Where alternatives are shown, applications should be updated to use them.如果显示了替代方案,则应更新应用程序以使用它们。
For MySQL 5.7 applications that use features removed in MySQL 8.0, statements may fail when replicated from a MySQL 5.7 source to a MySQL 8.0 replica, or may have different effects on source and replica. 对于使用MySQL 8.0中删除的功能的MySQL 5.7应用程序,当从MySQL 5.7源复制到MySQL 8.0副本时,语句可能会失败,或者对源和副本有不同的影响。To avoid such problems, applications that use features removed in MySQL 8.0 should be revised to avoid them and use alternatives when possible.为了避免此类问题,使用MySQL 8.0中删除的功能的应用程序应该进行修改,以避免这些问题,并在可能的情况下使用替代方法。
The innodb_locks_unsafe_for_binlog
system variable was removed. innodb_locks_unsafe_for_binlog
系统变量已删除。The READ COMMITTED
isolation level provides similar functionality.READ COMMITTED
隔离级别提供了类似的功能。
The MySQL 8.0.0中引入的information_schema_stats
variable, introduced in MySQL 8.0.0, was removed and replaced by information_schema_stats_expiry
in MySQL 8.0.3.information_schema_stats
变量已被删除,并替换为MySQL 8.0.3中的information_schema_stats_expiry
。
information_schema_stats_expiry
defines an expiration setting for cached INFORMATION_SCHEMA
table statistics. information_schema_stats_expiry
定义缓存的INFORMATION_SCHEMA
表统计的过期设置。For more information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.有关更多信息,请参阅第8.2.3节,“优化信息和模式查询”。
Code related to obsoleted MySQL8.0.3中删除了过时的InnoDB
system tables was removed in MySQL 8.0.3. InnoDB
系统表的相关代码。将基于INFORMATION_SCHEMA
views based on InnoDB
system tables were replaced by internal system views on data dictionary tables. InnoDB
系统表的INFORMATION_SCHEMA
视图替换为数据字典表的内部系统视图。Affected 受影响的InnoDB
INFORMATION_SCHEMA
views were renamed:InnoDB
INFORMATION_SCHEMA
视图已重命名:
Table 1.1 Renamed InnoDB Information Schema Views重命名的InnoDB信息架构视图
INNODB_SYS_COLUMNS | INNODB_COLUMNS |
INNODB_SYS_DATAFILES | INNODB_DATAFILES |
INNODB_SYS_FIELDS | INNODB_FIELDS |
INNODB_SYS_FOREIGN | INNODB_FOREIGN |
INNODB_SYS_FOREIGN_COLS | INNODB_FOREIGN_COLS |
INNODB_SYS_INDEXES | INNODB_INDEXES |
INNODB_SYS_TABLES | INNODB_TABLES |
INNODB_SYS_TABLESPACES | INNODB_TABLESPACES |
INNODB_SYS_TABLESTATS | INNODB_TABLESTATS |
INNODB_SYS_VIRTUAL | INNODB_VIRTUAL |
After upgrading to MySQL 8.0.3 or later, update any scripts that reference previous 升级到MySQL 8.0.3或更高版本后,请更新引用以前InnoDB
INFORMATION_SCHEMA
view names.InnoDB
INFORMATION_SCHEMA
视图名称的所有脚本。
The following features related to account management are removed:以下与帐户管理相关的功能将被删除:
Using 使用GRANT
to create users. GRANT
创建用户。Instead, use 请改用CREATE USER
. CREATE USER
。Following this practice makes the 按照这种做法,NO_AUTO_CREATE_USER
SQL mode immaterial for GRANT
statements, so it too is removed, and an error now is written to the server log when the presence of this value for the sql_mode
option in the options file prevents mysqld from starting.NO_AUTO_CREATE_USER
SQL模式对于GRANT
语句来说无关紧要,因此它也被删除,并且当选项文件中的sql_mode
选项的这个值阻止mysqld启动时,一个错误现在被写入服务器日志。
Using 使用GRANT
to modify account properties other than privilege assignments. GRANT
修改除特权分配以外的帐户属性。This includes authentication, SSL, and resource-limit properties. 这包括身份验证、SSL和资源限制属性。Instead, establish such properties at account-creation time with 相反,可以在创建帐户时使用CREATE USER
or modify them afterward with ALTER USER
.CREATE USER
建立这些属性,或者在之后使用ALTER USER
修改它们。
针对IDENTIFIED BY PASSWORD '
syntax for auth_string
'CREATE USER
and GRANT
. CREATE USER
和GRANT
的IDENTIFIED BY PASSWORD '
语法。auth_string
'Instead, use 对于IDENTIFIED WITH
for auth_plugin
AS 'auth_string
'CREATE USER
and ALTER USER
, where the '
value is in a format compatible with the named plugin.auth_string
'CREATE USER
和ALTER USER
,请改用IDENTIFIED WITH
,其中auth_plugin
AS 'auth_string
''
值的格式与命名插件兼容。auth_string
'
Additionally, because 此外,由于IDENTIFIED BY PASSWORD
syntax was removed, the log_builtin_as_identified_by_password
system variable is superfluous and was removed.IDENTIFIED BY PASSWORD
语法已被删除,因此log_builtin_as_identified_by_password
系统变量是多余的,因此已被删除。
The PASSWORD()
function. PASSWORD()
函数。Additionally, 此外,删除PASSWORD()
removal means that SET PASSWORD ... = PASSWORD('
syntax is no longer available.auth_string
')PASSWORD()
意味着SET PASSWORD ... = PASSWORD('
语法不再可用。auth_string
')
The old_passwords
system variable.old_passwords
系统变量。
The query cache was removed. Removal includes these items:已删除查询缓存。拆除包括以下项目:
The FLUSH QUERY CACHE
and RESET QUERY CACHE
statements.FLUSH QUERY CACHE
语句和RESET QUERY CACHE
语句。
These system variables: 这些系统变量:query_cache_limit
, query_cache_min_res_unit
, query_cache_size
, query_cache_type
, query_cache_wlock_invalidate
.query_cache_limit
、query_cache_min_res_unit
、query_cache_size
、query_cache_type
、query_cache_wlock_invalidate
。
These status variables: 这些状态变量:Qcache_free_blocks
, Qcache_free_memory
, Qcache_hits
, Qcache_inserts
, Qcache_lowmem_prunes
, Qcache_not_cached
, Qcache_queries_in_cache
, Qcache_total_blocks
.Qcache_free_blocks
、Qcache_free_memory
、Qcache_hits
、Qcache_inserts
、Qcache_lowmem_prunes
、Qcache_not_cached
、Qcache_queries_in_cache
、Qcache_total_blocks
。
These thread states: 这些线程状态:checking privileges on cached query
, checking query cache for query
, invalidating query cache entries
, sending cached result to client
, storing result in query cache
, Waiting for query cache lock
.checking privileges on cached query
、checking query cache for query
、invalidating query cache entries
、sending cached result to client
、storing result in query cache
、Waiting for query cache lock
。
The SQL_CACHE
SELECT
modifier.SELECT
修饰符SQL_CACHE
。
These deprecated query cache items remain deprecated, but have no effect; expect them to be removed in a future MySQL release:这些不推荐使用的查询缓存项仍然不推荐使用,但没有任何效果;希望在将来的MySQL版本中删除它们:
The SQL_NO_CACHE
SELECT
modifier.SELECT
修饰符SQL_NO_CACHE
。
The ndb_cache_check_time
system variable.ndb_cache_check_time
系统变量。
The have_query_cache
system variable remains deprecated, and always has a value of NO
; expect it to be removed in a future MySQL release.have_query_cache
系统变量仍然不推荐使用,并且始终具有值NO
;希望在将来的MySQL版本中删除它。
The data dictionary provides information about database objects, so the server no longer checks directory names in the data directory to find databases. 数据字典提供有关数据库对象的信息,因此服务器不再检查数据目录中的目录名来查找数据库。Consequently, the 因此,--ignore-db-dir
option and ignore_db_dirs
system variables are extraneous and are removed.--ignore-db-dir
选项和ignore_db_dirs
系统变量是无关的,将被删除。
The DDL log, also known as the metadata log, has been removed. DDL日志(也称为元数据日志)已被删除。Beginning with MySQL 8.0.3, this functionality is handled by the data dictionary 从MySQL 8.0.3开始,这个功能由数据字典innodb_ddl_log
table. innodb_ddl_log
表处理。See Viewing DDL Logs.请参阅查看DDL日志。
The tx_isolation
and tx_read_only
system variables have been removed. tx_isolation
和tx_read_only
系统变量已删除。Use 改用transaction_isolation
and transaction_read_only
instead.transaction_isolation
和transaction_read_only
。
The sync_frm
system variable has been removed because .frm
files have become obsolete.sync_frm
系统变量已被删除,因为.frm
文件已过时。
The secure_auth
system variable and --secure-auth
client option have been removed. secure_auth
系统变量和--secure-auth
客户端选项已被删除。The MYSQL_SECURE_AUTH
option for the mysql_options()
C API function was removed.MYSQL_options()
C API函数的MYSQL_SECURE_AUTH
选项已删除。
The multi_range_count
system variable is removed.multi_range_count
系统变量被删除。
The 已删除log_warnings
system variable and --log-warnings
server option have been removed. log_warnings
系统变量和--log warnings
服务器选项。Use the 请改用log_error_verbosity
system variable instead.log_error_verbosity
系统变量。
The global scope for the sql_log_bin
system variable was removed. sql_log_bin
系统变量的全局作用域已删除。sql_log_bin
has session scope only, and applications that rely on accessing @@GLOBAL.sql_log_bin
should be adjusted.sql_log_bin
只有会话作用域,应该调整依赖于访问@@GLOBAL.sql_log_bin
的应用程序。
The metadata_locks_cache_size
and metadata_locks_hash_instances
system variables are removed.metadata_locks_cache_size
和metadata_locks_hash_instances
系统变量将被删除。
The unused 未使用的date_format
, datetime_format
, time_format
, and max_tmp_tables
system variables are removed.date_format
、datetime_format
、time_format
和max_tmp_tables
系统变量将被删除。
These deprecated compatibility SQL modes are removed: 这些不推荐使用的兼容SQL模式被删除:DB2
, MAXDB
, MSSQL
, MYSQL323
, MYSQL40
, ORACLE
, POSTGRESQL
, NO_FIELD_OPTIONS
, NO_KEY_OPTIONS
, NO_TABLE_OPTIONS
. DB2
、MAXDB
、MSSQL
、MYSQL323
、MYSQL40
、ORACLE
、POSTGRESQL
、NO_FIELD_OPTIONS
、NO_KEY_OPTIONS
、NO_TABLE_OPTIONS
。They can no longer be assigned to the 它们不能再分配给sql_mode
system variable or used as permitted values for the mysqldump --compatible
option.sql_mode
系统变量或用作mysqldump--compatible
选项的允许值。
Removal of 删除MAXDB
means that the TIMESTAMP
data type for CREATE TABLE
or ALTER TABLE
is treated as TIMESTAMP
, and is no longer treated as DATETIME
.MAXDB
意味着CREATE TABLE
或ALTER TABLE
的TIMESTAMP
数据类型被视为TIMESTAMP
,不再被视为DATETIME
。
The deprecated ASC
or DESC
qualifiers for GROUP BY
clauses are removed. GROUP BY
子句的已弃用的ASC
或DESC
限定符将被删除。Queries that previously relied on 以前依赖GROUP BY
sorting may produce results that differ from previous MySQL versions. GROUP BY
排序的查询可能会产生不同于以前MySQL版本的结果。To produce a given sort order, provide an 要生成给定的排序顺序,请提供ORDER BY
clause.ORDER BY
子句。
The EXTENDED
and PARTITIONS
keywords for the EXPLAIN
statement have been removed. EXPLAIN
语句的EXTENDED
和PARTITIONS
关键字已被删除。These keywords are unnecessary because their effect is always enabled.这些关键字是不必要的,因为它们的效果始终是启用的。
These encryption-related items are removed:这些与加密相关的项目将被删除:
The ENCODE()
and DECODE()
functions.ENCODE()
函数和DECODE()
函数。
The ENCRYPT()
function.ENCRYPT()
函数。
The DES_ENCRYPT()
, and DES_DECRYPT()
functions, the --des-key-file
option, the have_crypt
system variable, the DES_KEY_FILE
option for the FLUSH
statement, and the HAVE_CRYPT
CMake option.DES_ENCRYPT()
函数和DES_DECRYPT()
函数、--des-key-file
选项、have_crypt
系统变量、FLUSH
语句的DES_KEY_FILE
选项和HAVE_CRYPT
CMake选项。
In place of the removed encryption functions: For 代替加密函数:对于ENCRYPT()
, consider using SHA2()
instead for one-way hashing. ENCRYPT()
,考虑改用ShA2()
,而不是单向散列。For the others, consider using 对于其他的,考虑改用AES_ENCRYPT()
and AES_DECRYPT()
instead.AES_ENCRYPT()
和AES_DECRYPT()
。
In MySQL 5.7, several spatial functions available under multiple names were deprecated to move in the direction of making the spatial function namespace more consistent, the goal being that each spatial function name begin with 在MySQL5.7中,不推荐使用多个名称下的多个可用空间函数,以使空间函数名称空间更加一致,目标是如果每个空间函数名称执行精确的操作,则以ST_
if it performs an exact operation, or with MBR
if it performs an operation based on minimum bounding rectangles. ST_
开头;如果每个空间函数名称执行基于最小边界矩形的操作,则以MBR
开头。In MySQL 8.0, the deprecated functions are removed to leave only the corresponding 在MySQL 8.0中,不推荐使用的函数被删除,只保留相应的ST_
and MBR
functions:ST_
和MBR
函数:
These functions are removed in favor of the 为了支持MBR
names: Contains()
, Disjoint()
, Equals()
, Intersects()
, Overlaps()
, Within()
.MBR
名称,这些函数已被删除:Contains()
、Disjoint()
、Equals()
、Intersects()
、Overlaps()
、Within()
。
These functions are removed in favor of the 为了支持ST_
names: ST_
名称,这些函数已被删除:Area()
, AsBinary()
, AsText()
, AsWKB()
, AsWKT()
, Buffer()
, Centroid()
, ConvexHull()
, Crosses()
, Dimension()
, Distance()
, EndPoint()
, Envelope()
, ExteriorRing()
, GeomCollFromText()
, GeomCollFromWKB()
, GeomFromText()
, GeomFromWKB()
, GeometryCollectionFromText()
, GeometryCollectionFromWKB()
, GeometryFromText()
, GeometryFromWKB()
, GeometryN()
, GeometryType()
, InteriorRingN()
, IsClosed()
, IsEmpty()
, IsSimple()
, LineFromText()
, LineFromWKB()
, LineStringFromText()
, LineStringFromWKB()
, MLineFromText()
, MLineFromWKB()
, MPointFromText()
, MPointFromWKB()
, MPolyFromText()
, MPolyFromWKB()
, MultiLineStringFromText()
, MultiLineStringFromWKB()
, MultiPointFromText()
, MultiPointFromWKB()
, MultiPolygonFromText()
, MultiPolygonFromWKB()
, NumGeometries()
, NumInteriorRings()
, NumPoints()
, PointFromText()
, PointFromWKB()
, PointN()
, PolyFromText()
, PolyFromWKB()
, PolygonFromText()
, PolygonFromWKB()
, SRID()
, StartPoint()
, Touches()
, X()
, Y()
.Area()
、AsBinary()
、AsText()
、AsWKB()
、AsWKT()
、Buffer()
、Centroid()
、ConvexHull()
、Crosses()
、Dimension()
、Distance()
、EndPoint()
、Envelope()
、ExteriorRing()
、GeomCollFromText()
、GeomCollFromWKB()
、GeomFromText()
、GeomFromWKB()
、GeometryCollectionFromText()
、GeometryCollectionFromWKB()
、GeometryFromText()
、GeometryFromWKB()
、GeometryN()
、GeometryType()
、InteriorRingN()
、IsClosed()
、IsEmpty()
、IsSimple()
、LineFromText()
、LineFromWKB()
、LineStringFromText()
、LineStringFromWKB()
、MLineFromText()
、MLineFromWKB()
、MPointFromText()
、MPointFromWKB()
、MPolyFromText()
、MPolyFromWKB()
、MultiLineStringFromText()
、MultiLineStringFromWKB()
、MultiPointFromText()
、MultiPointFromWKB()
、MultiPolygonFromText()
、MultiPolygonFromWKB()
、NumGeometries()
、NumInteriorRings()
、NumPoints()
、PointFromText()
、PointFromWKB()
、PointN()
、PolyFromText()
、PolyFromWKB()
、PolygonFromText()
、PolygonFromWKB()
、SRID()
、StartPoint()
、Touches()
、X()
、Y()
。
为了支持GLength()
is removed in favor of ST_Length()
.ST_Length()
,GLength()
已被删除。
The functions described in Section 12.17.4, “Functions That Create Geometry Values from WKB Values” previously accepted either WKB strings or geometry arguments. 第12.17.4节,“从WKB值创建几何值的函数”中描述的函数以前接受WKB字符串或几何参数。Geometry arguments are no longer permitted and produce an error. 几何参数不再被允许并产生错误。See that section for guidelines for migrating queries away from using geometry arguments.有关从使用几何参数迁移查询的指导原则,请参见该部分。
The parser no longer treats 分析器不再将\N
as a synonym for NULL
in SQL statements. \N
视为SQL语句中NULL
的同义词。Use 请改用NULL
instead.NULL
。
This change does not affect text file import or export operations performed with 此更改不影响使用LOAD DATA
or SELECT ... INTO OUTFILE
, for which NULL
continues to be represented by \N
. LOAD DATA
或SELECT ... INTO OUTFILE
执行的文本文件导入或导出操作,其中NULL
继续由\N
表示。See Section 13.2.7, “LOAD DATA Statement”.请参阅第13.2.7节,“LOAD DATA语句”。
PROCEDURE ANALYSE()
syntax is removed.PROCEDURE ANALYSE()
语法已被删除。
The client-side 客户端--ssl
and --ssl-verify-server-cert
options have been removed. --ssl
和--ssl-verify-server-cert
选项已被删除。Use 请使用--ssl-mode=REQUIRED
instead of --ssl=1
or --enable-ssl
. --ssl-mode=REQUIRED
而不是--ssl=1
或--enable-ssl
。Use 使用--ssl-mode=DISABLED
instead of --ssl=0
, --skip-ssl
, or --disable-ssl
. --ssl-mode=DISABLED
而不是--ssl=0
、--skip-ssl
或--disable-ssl
。Use 使用--ssl-mode=VERIFY_IDENTITY
instead of --ssl-verify-server-cert
options. --ssl-mode=VERIFY_IDENTITY
而不是--ssl-verify-server-cert
选项。(The server-side (服务器端--ssl
option is still available, but is deprecated as of MySQL 8.0.26 and subject to removal in a future MySQL version.)--ssl
选项仍然可用,但从MySQL8.0.26开始就不推荐使用,在将来的MySQL版本中可能会被删除。)
For the C API, 对于C API,针对MYSQL_OPT_SSL_ENFORCE
and MYSQL_OPT_SSL_VERIFY_SERVER_CERT
options for mysql_options()
correspond to the client-side --ssl
and --ssl-verify-server-cert
options and are removed. MYSQL_options()
的MYSQL_OPT_SSL_ENFORCE
和MYSQL_OPT_SSL_VERIFY_SERVER_CERT
选项对应于客户端--ssl
选项和--ssl-verify-server-cert
选项,并且已被删除。Use 使用选项值为MYSQL_OPT_SSL_MODE
with an option value of SSL_MODE_REQUIRED
or SSL_MODE_VERIFY_IDENTITY
instead.SSL_MODE_REQUIRED
或SSL_MODE_VERIFY_IDENTITY
的MYSQL_OPT_SSL_MODE
。
The 已删除--temp-pool
server option was removed.--temp-pool
服务器选项。
The 已删除ignore_builtin_innodb
system variable is removed.ignore_builtin_innodb
系统变量。
The server no longer performs conversion of pre-MySQL 5.1 database names containing special characters to 5.1 format with the addition of a 服务器不再执行将包含特殊字符的MySQL5.1之前版本的数据库名称转换为5.1格式,并添加一个#mysql50#
prefix. #mysql50#
前缀。Because these conversions are no longer performed, the 由于不再执行这些转换,--fix-db-names
and --fix-table-names
options for mysqlcheck, the UPGRADE DATA DIRECTORY NAME
clause for the ALTER DATABASE
statement, and the Com_alter_db_upgrade
status variable are removed.mysqlcheck
的--fix-db-names
t选项和--fix-table-names
选项、ALTER DATABASE
语句的UPGRADE DATA DIRECTORY NAME
子句以及Com_alter_db_upgrade
状态变量都被删除。
Upgrades are supported only from one major version to another (for example, 5.0 to 5.1, or 5.1 to 5.5), so there should be little remaining need for conversion of older 5.0 database names to current versions of MySQL. 只支持从一个主版本升级到另一个主版本(例如,5.0到5.1,或5.1到5.5),因此应该不需要将旧的5.0数据库名称转换为当前版本的MySQL。As a workaround, upgrade a MySQL 5.0 installation to MySQL 5.1 before upgrading to a more recent release.作为一种解决方法,请先将MySQL5.0安装升级到MySQL5.1,然后再升级到较新的版本。
The mysql_install_db program has been removed from MySQL distributions. mysql_install_db程序已从mysql发行版中删除。Data directory initialization should be performed by invoking mysqld with the 数据目录初始化应该通过使用--initialize
or --initialize-insecure
option instead. --initialize
或--initialize-unsecure
选项调用mysqld来执行。In addition, the 此外,--bootstrap
option for mysqld that was used by mysql_install_db was removed, and the INSTALL_SCRIPTDIR
CMake
option that controlled the installation location for mysql_install_db was removed.mysql_install_db
使用的--bootstrap
选项被删除,控制mysql_install_db
安装位置的INSTALL_SCRIPTDIR
CMake选项也被删除。
The generic partitioning handler was removed from the MySQL server. 通用分区处理程序已从MySQL服务器中删除。In order to support partitioning of a given table, the storage engine used for the table must now provide its own (“native”) partitioning handler. 为了支持给定表的分区,用于该表的存储引擎现在必须提供自己的(“本机”)分区处理程序。The 从MySQL服务器中删除--partition
and --skip-partition
options are removed from the MySQL Server, and partitioning-related entries are no longer shown in the output of SHOW PLUGINS
or in the INFORMATION_SCHEMA.PLUGINS
table.--partition
和--skip-partition
选项,与分区相关的条目不再显示在SHOW PLUGINS
的输出或INFORMATION_SCHEMA.PLUGINS
表中。
Two MySQL storage engines currently provide native partitioning support: 目前有两个MySQL存储引擎提供本机分区支持:InnoDB
and NDB
. InnoDB
和NDB
。Of these, only 其中MySQL 8.0只支持InnoDB
is supported in MySQL 8.0. InnoDB
。Any attempt to create partitioned tables in MySQL 8.0 using any other storage engine fails.在MySQL 8.0中使用任何其他存储引擎创建分区表的任何尝试都将失败。
Ramifications for upgrades.升级的后果。 The direct upgrade of a partitioned table using a storage engine other than 不支持使用InnoDB
(such as MyISAM
) from MySQL 5.7 (or earlier) to MySQL 8.0 is not supported. InnoDB
以外的存储引擎(如MyISAM)将分区表从MySQL5.7(或更早版本)直接升级到MySQL8.0。There are two options for handling such a table:处理此类表有两个选项:
Remove the table's partitioning, using 删除表的分区,使用ALTER TABLE ... REMOVE PARTITIONING
.ALTER TABLE ... REMOVE PARTITIONING
。
Change the storage engine used for the table to 将用于表的存储引擎更改为InnoDB
, with ALTER TABLE ... ENGINE=INNODB
.InnoDB
,使用ALTER TABLE ... ENGINE=INNODB
。
At least one of the two operations just listed must be performed for each partitioned non-在将服务器升级到MySQL 8.0之前,必须对每个分区的非InnoDB
table prior to upgrading the server to MySQL 8.0. InnoDB
表执行刚才列出的两个操作中的至少一个。Otherwise, such a table cannot be used following the upgrade.否则,升级后不能使用这样的表。
Due to the fact that table creation statements that would result in a partitioned table using a storage engine without partitioning support now fail with an error (ER_CHECK_NOT_IMPLEMENTED), you must make sure that any statements in a dump file (such as that written by mysqldump) from an older version of MySQL that you wish to import into a MySQL 8.0 server that create partitioned tables do not also specify a storage engine such as 由于表创建语句会导致使用不支持分区的存储引擎的分区表现在失败并出现错误(MyISAM
that has no native partitioning handler. ER_CHECK_NOT_IMPLEMENTED
),您必须确保转储文件中的任何语句(如mysqldump编写的语句)都不会指定没有本机分区处理程序的存储引擎,例如MyISAM
。You can do this by performing either of the following:您可以通过执行以下任一操作来执行此操作:
Remove any references to partitioning from 从CREATE TABLE
statements that use a value for the STORAGE ENGINE
option other than InnoDB
.CREATE TABLE
语句中删除对分区的任何引用,这些语句使用的存储引擎选项值不是InnoDB
。
Specifying the storage engine as 将存储引擎指定为InnoDB
, or allow InnoDB
to be used as the table's storage engine by default.InnoDB
,或者默认情况下允许将InnoDB
用作表的存储引擎。
For more information, see Section 24.6.2, “Partitioning Limitations Relating to Storage Engines”.有关更多信息,请参阅第24.6.2节,“与存储引擎相关的分区限制”。
System and status variable information is no longer maintained in the 系统和状态变量信息不再保留在INFORMATION_SCHEMA
. INFORMATION_SCHEMA
中。These tables are removed: 这些表已被删除:GLOBAL_VARIABLES
, SESSION_VARIABLES
, GLOBAL_STATUS
, SESSION_STATUS
. GLOBAL_VARIABLES
、SESSION_VARIABLES
、GLOBAL_STATUS
、SESSION_STATUS
。Use the corresponding Performance Schema tables instead. 改用相应的性能架构表。See Section 27.12.14, “Performance Schema System Variable Tables”, and Section 27.12.15, “Performance Schema Status Variable Tables”. 请参阅第27.12.14节,“性能模式系统变量表”和第27.12.15节,“性能模式状态变量表”。In addition, the 此外,show_compatibility_56
system variable was removed. show_compatibility_56
系统变量已删除。It was used in the transition period during which system and status variable information in 它用于过渡时期,在此期间,INFORMATION_SCHEMA
tables was moved to Performance Schema tables, and is no longer needed. INFORMATION_SCHEMA<
表中的系统和状态变量信息被移动到性能架构表中,不再需要。These status variables are removed: 这些状态变量被删除:Slave_heartbeat_period
, Slave_last_heartbeat
, Slave_received_heartbeats
, Slave_retried_transactions
, Slave_running
. Slave_heartbeat_period
、Slave_last_heartbeat
、Slave_received_heartbeat
、Slave_retried_transactions
、Slave_running
。The information they provided is available in Performance Schema tables; see Migrating to Performance Schema System and Status Variable Tables.他们提供的信息可以在性能模式表中找到;请参阅迁移到性能模式系统和状态变量表。
The Performance Schema 性能架构setup_timers
table was removed, as was the TICK
row in the performance_timers
table.setup_timers
表已删除,performance_timers
表中的TICK
行也已删除。
The 已删除libmysqld
embedded server library is removed, along with:libmysqld
嵌入式服务器库,同时删除:
The mysql_options()
MYSQL_OPT_GUESS_CONNECTION
, MYSQL_OPT_USE_EMBEDDED_CONNECTION
, MYSQL_OPT_USE_REMOTE_CONNECTION
, and MYSQL_SET_CLIENT_IP
optionsmysql_options()
、MYSQL_OPT_GUESS_CONNECTION
、MYSQL_OPT_USE_EMBEDDED_CONNECTION
、MYSQL_OPT_USE_REMOTE_CONNECTION
和MYSQL_SET_CLIENT_IP
选项
The mysql_config mysql_config--libmysqld-libs
, --embedded-libs
, and --embedded
options--libmysqld-libs
、--embedded-libs
和--embedded
选项
The CMake CMake WITH_EMBEDDED_SERVER
, WITH_EMBEDDED_SHARED_LIBRARY
, and INSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR
optionsWITH_EMBEDDED_SERVER
、WITH_EMBEDDED_SHARED_LIBRARY
和INSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR
选项
The (undocumented) mysql (未记录的)mysql--server-arg
option--server-arg
选项
The mysqltest mysqltest--embedded-server
, --server-arg
, and --server-file
options--embedded-server
、--server-arg
和--server-file
选项
The mysqltest_embedded and mysql_client_test_embedded test programsmysqltest_embedded和mysql_client_test_embedded测试程序
The mysql_plugin utility was removed. mysql_plugin实用程序已被删除。Alternatives include loading plugins at server startup using the 替代方法包括在服务器启动时使用--plugin-load
or --plugin-load-add
option, or at runtime using the INSTALL PLUGIN
statement.-plugin-load
或--plugin-load-add
选项加载插件,或者在运行时使用INSTALL PLUGIN
语句加载插件。
The resolveip utility is removed. 已删除resolveip实用程序。nslookup, host, or dig can be used instead.可以改用nslookup、host或dig。
The resolve_stack_dump utility is removed. 已删除resolve_stack_dump实用程序。Stack traces from official MySQL builds are always symbolized, so there is no need to use resolve_stack_dump.官方MySQL版本的堆栈跟踪总是符号化的,所以不需要使用resolve_Stack_dump。
The following server error codes are not used and have been removed. 以下服务器错误代码未使用,已被删除。Applications that test specifically for any of these errors should be updated.应该更新专门针对这些错误进行测试的应用程序。
ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE ER_BINLOG_ROW_RBR_TO_SBR ER_BINLOG_ROW_WRONG_TABLE_DEF ER_CANT_ACTIVATE_LOG ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION ER_CANT_CREATE_FEDERATED_TABLE ER_CANT_CREATE_SROUTINE ER_CANT_DELETE_FILE ER_CANT_GET_WD ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF ER_CANT_SET_WD ER_CANT_WRITE_LOCK_LOG_TABLE ER_CREATE_DB_WITH_READ_LOCK ER_CYCLIC_REFERENCE ER_DB_DROP_DELETE ER_DELAYED_NOT_SUPPORTED ER_DIFF_GROUPS_PROC ER_DISK_FULL ER_DROP_DB_WITH_READ_LOCK ER_DROP_USER ER_DUMP_NOT_IMPLEMENTED ER_ERROR_DURING_CHECKPOINT ER_ERROR_ON_CLOSE ER_EVENTS_DB_ERROR ER_EVENT_CANNOT_DELETE ER_EVENT_CANT_ALTER ER_EVENT_COMPILE_ERROR ER_EVENT_DATA_TOO_LONG ER_EVENT_DROP_FAILED ER_EVENT_MODIFY_QUEUE_ERROR ER_EVENT_NEITHER_M_EXPR_NOR_M_AT ER_EVENT_OPEN_TABLE_FAILED ER_EVENT_STORE_FAILED ER_EXEC_STMT_WITH_OPEN_CURSOR ER_FAILED_ROUTINE_BREAK_BINLOG ER_FLUSH_MASTER_BINLOG_CLOSED ER_FORM_NOT_FOUND ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED ER_FRM_UNKNOWN_TYPE ER_GOT_SIGNAL ER_GRANT_PLUGIN_USER_EXISTS ER_GTID_MODE_REQUIRES_BINLOG ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST ER_HASHCHK ER_INDEX_REBUILD ER_INNODB_NO_FT_USES_PARSER ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR ER_LOAD_DATA_INVALID_COLUMN_UNUSED ER_LOGGING_PROHIBIT_CHANGING_OF ER_MALFORMED_DEFINER ER_MASTER_KEY_ROTATION_ERROR_BY_SE ER_NDB_CANT_SWITCH_BINLOG_FORMAT ER_NEVER_USED ER_NISAMCHK ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR ER_NO_FILE_MAPPING ER_NO_GROUP_FOR_PROC ER_NO_RAID_COMPILED ER_NO_SUCH_KEY_VALUE ER_NO_SUCH_PARTITION__UNUSED ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED ER_ORDER_WITH_PROC ER_PARTITION_SUBPARTITION_ERROR ER_PARTITION_SUBPART_MIX_ERROR ER_PART_STATE_ERROR ER_PASSWD_LENGTH ER_QUERY_ON_MASTER ER_RBR_NOT_AVAILABLE ER_SKIPPING_LOGGED_TRANSACTION ER_SLAVE_CHANNEL_DELETE ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT ER_SLAVE_MUST_STOP ER_SLAVE_WAS_NOT_RUNNING ER_SLAVE_WAS_RUNNING ER_SP_GOTO_IN_HNDLR ER_SP_PROC_TABLE_CORRUPT ER_SQL_MODE_NO_EFFECT ER_SR_INVALID_CREATION_CTX ER_TABLE_NEEDS_UPG_PART ER_TOO_MUCH_AUTO_TIMESTAMP_COLS ER_UNEXPECTED_EOF ER_UNION_TABLES_IN_DIFFERENT_DIR ER_UNSUPPORTED_BY_REPLICATION_THREAD ER_UNUSED1 ER_UNUSED2 ER_UNUSED3 ER_UNUSED4 ER_UNUSED5 ER_UNUSED6 ER_VIEW_SELECT_DERIVED_UNUSED ER_WRONG_MAGIC ER_WSAS_FAILED
The deprecated 不推荐使用的INFORMATION_SCHEMA
INNODB_LOCKS
and INNODB_LOCK_WAITS
tables are removed. INFORMATION_SCHEMA
INNODB_LOCKS
和INNODB_LOCK_WAITS
表被删除。Use the Performance Schema 改为使用性能架构data_locks
and data_lock_waits
tables instead.data_locks
和data_lock_waits
表。
In MySQL 5.7, the 在MySQL 5.7中,LOCK_TABLE
column in the INNODB_LOCKS
table and the locked_table
column in the sys
schema innodb_lock_waits
and x$innodb_lock_waits
views contain combined schema/table name values. INNODB_LOCKS
表中的LOCK_TABLE
列以及sys
架构innodb_lock_waits
和x$innodb_lock_waits
视图中的locked_table
列包含组合模式/表名值。In MySQL 8.0, the 在MySQL 8.0中,data_locks
table and the sys
schema views contain separate schema name and table name columns. data_locks
表和sys
架构视图包含单独的架构名称和表名称列。See Section 28.4.3.9, “The innodb_lock_waits and x$innodb_lock_waits Views”.请参阅第28.4.3.9节,“innodb_lock_waits和x$innodb_lock_waits视图”。
InnoDB
no longer supports compressed temporary tables. InnoDB
不再支持压缩的临时表。When 当innodb_strict_mode
is enabled (the default), CREATE TEMPORARY TABLE
returns an error if ROW_FORMAT=COMPRESSED
or KEY_BLOCK_SIZE
is specified. innodb_strict_mode
处于启用状态(默认)时,如果指定了ROW_FORMAT=COMPRESSED
或KEY_BLOCK_SIZE
,则CREATE TEMPORARY TABLE
将返回错误。If 如果禁用了innodb_strict_mode
is disabled, warnings are issued and the temporary table is created using a non-compressed row format.innodb_strict_mode
,将发出警告,并使用非压缩行格式创建临时表。
在MySQL数据目录之外创建表空间数据文件时,InnoDB
no longer creates .isl
files (InnoDB
Symbolic Link files) when creating tablespace data files outside of the MySQL data directory. InnoDB
不再创建.isl
vs文件(InnoDB
符号链接文件)。The innodb_directories
option now supports locating tablespace files created outside of the data directory.innodb_directories
选项现在支持定位在数据目录之外创建的表空间文件。
With this change, moving a remote tablespace while the server is offline by manually modifying an 通过此更改,不再支持在服务器脱机时通过手动修改.isl
file is no longer supported. .isl
文件来移动远程表空间。Moving remote tablespace files is now supported by the innodb_directories
option. innodb_directories
选项现在支持移动远程表空间文件。See Section 15.6.3.6, “Moving Tablespace Files While the Server is Offline”.请参阅第15.6.3.6节,“在服务器脱机时移动表空间文件”。
The following 已删除以下InnoDB
file format variables were removed:InnoDB
文件格式变量:
innodb_file_format
innodb_file_format_check
innodb_file_format_max
innodb_large_prefix
File format variables were necessary for creating tables compatible with earlier versions of 文件格式变量对于创建与MySQL 5.1中早期版本的InnoDB
in MySQL 5.1. InnoDB
兼容的表是必需的。Now that MySQL 5.1 has reached the end of its product lifecycle, these options are no longer required.现在MySQL 5.1已经到了其产品生命周期的末尾,不再需要这些选项。
The FILE_FORMAT
column was removed from the INNODB_TABLES
and INNODB_TABLESPACES
Information Schema tables.FILE_FORMAT
列已从INNODB_TABLES
和INNODB_TABLESPACES
信息架构表中删除。
The innodb_support_xa
system variable, which enables support for two-phase commit in XA transactions, was removed. innodb_support_xa
系统变量已被删除,该变量支持XA事务中的两阶段提交。始终启用对XA事务中两阶段提交的InnoDB
support for two-phase commit in XA transactions is always enabled.InnoDB
支持。
Support for DTrace was removed.已删除对DTrace的支持。
The 已删除JSON_APPEND()
function was removed. Use JSON_ARRAY_APPEND()
instead.JSON_APPEND()
函数。改为使用JSON_ARRAY_APPEND()
。
Support for placing table partitions in shared MySQL 8.0.13中删除了在共享InnoDB
tablespaces was removed in MySQL 8.0.13. InnoDB
表空间中放置表分区的支持。Shared tablespaces include the 共享表空间包括InnoDB
system tablespace and general tablespaces. InnoDB
系统表空间和通用表空间。For information about identifying partitions in shared tablespaces and moving them to file-per-table tablespaces, see Section 2.11.5, “Preparing Your Installation for Upgrade”.有关标识共享表空间中的分区并将其移动到每个表的文件表空间的信息,请参阅第2.11.5节,“准备升级安装”。
Support for setting user variables in statements other than MySQL 8.0.13不赞成在非SET
was deprecated in MySQL 8.0.13. SET
语句中设置用户变量。This functionality is subject to removal in MySQL 9.0.此功能可能会在MySQL 9.0中删除。
The 已删除--ndb
perror option was removed. --ndb
perror选项。Use the ndb_perror utility instead.请改用ndb_perror实用程序。
The innodb_undo_logs
variable was removed. innodb_undo_logs
变量已删除。The innodb_rollback_segments
variables performs the same function and should be used instead.innodb_rollback_segments
变量执行相同的功能,应改用。
The Innodb_available_undo_logs
status variable was removed. Innodb_available_undo_logs
状态变量已删除。The number of available rollback segments per tablespace may be retrieved using 每个表空间的可用回滚段数可以使用SHOW VARIABLES LIKE 'innodb_rollback_segments';
SHOW VARIABLES LIKE 'innodb_rollback_segments';
进行检索;
As of MySQL 8.0.14, the previously deprecated 从MySQL 8.0.14开始,以前不推荐使用的innodb_undo_tablespaces
variable is no longer configurable. innodb_undo_tablespaces
变量不再是可配置的。For more information, see Section 15.6.3.4, “Undo Tablespaces”.有关更多信息,请参阅第15.6.3.4节,“撤消表空间”。
Support for the 对ALTER TABLE ... UPGRADE PARTITIONING
statement has been removed.ALTER TABLE ... UPGRADE PARTITIONING
语句的支持已被删除。
As of MySQL 8.0.16, support for the 从MySQL 8.0.16开始,已删除对internal_tmp_disk_storage_engine
system variable has been removed; internal temporary tables on disk now always use the InnoDB
storage engine. internal_tmp_disk_storage_engine
系统变量的支持;磁盘上的内部临时表现在总是使用InnoDB
存储引擎。See Storage Engine for On-Disk Internal Temporary Tables,for more information.有关更多信息,请参阅磁盘内部临时表的存储引擎。
The DISABLE_SHARED
CMake option was unused and has been removed.DISABLE_SHARED
CMake选项未使用,已被删除。