8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 83%

A.1 MySQL 8.4 常见问题解答:常规A.1 MySQL 8.4 FAQ: General

A.1.1. 哪个版本的 MySQL 已准备好用于生产(GA)? A.1.1. Which version of MySQL is production-ready (GA)?
A.1.2. 为什么 MySQL 版本号跳过了 6 和 7,直接到 8.0? A.1.2. Why did MySQL version numbering skip versions 6 and 7 and go straight to 8.0?
A.1.3. MySQL 能执行子查询吗? A.1.3. Can MySQL do subqueries?
A.1.4. MySQL 能执行多表插入、更新和删除操作吗? A.1.4. Can MySQL perform multiple-table inserts, updates, and deletes?
A.1.5. MySQL 有序列(Sequences)吗? A.1.5. Does MySQL have Sequences?
A.1.6. MySQL 的 NOW() 函数支持秒的分数吗? A.1.6. Does MySQL have a NOW() function with fractions of seconds?
A.1.7. MySQL 支持多核处理器吗? A.1.7. Does MySQL work with multi-core processors?
A.1.8. 为什么我会看到 mysqld 有多个进程? A.1.8. Why do I see multiple processes for mysqld?
A.1.9. MySQL 可以执行 ACID 事务吗? A.1.9. Can MySQL perform ACID transactions?

A.1.1.

哪个版本的 MySQL 可以用于生产环境(GA)?Which version of MySQL is production-ready (GA)?

MySQL 9.6、8.4 和 8.0 都可以在生产环境中使用并获得积极支持。MySQL 9.6, 8.4, and 8.0 are actively supported for production use.

MySQL 9 创新系列始于 2024 年 7 月 1 日发布的 MySQL 9.0.0。The MySQL 9 Innovation series began with the MySQL 9.0.0 release on 01 July 2024.

MySQL 8.4 LTS 系列始于 2024 年 4 月 30 日发布的 MySQL 8.4.0。The MySQL 8.4 LTS series began with the MySQL 8.4.0 release on 30 April 2024.

MySQL 8 创新系列始于 2023 年 7 月 18 日发布的 MySQL 8.1.0。积极开发在 2024 年 1 月 16 日随 MySQL 8.3.0 发布结束。The MySQL 8 Innovation series began with the MySQL 8.1.0 release on 18 July 2023. Active development ended on 2024-01-16 with the MySQL 8.3.0 release.

MySQL 8.0 在 MySQL 8.0.11 版本实现了全面可用(GA)状态,该版本于 2018 年 4 月 19 日发布用于生产环境。从 MySQL 8.0.34 开始,它成为了一个修复漏洞系列,并引入了 创新和长期支持(LTS)发布模型。MySQL 8.0 achieved General Availability (GA) status with MySQL 8.0.11, which was released for production use on 19 April 2018. It became a bugfix series as of MySQL 8.0.34 with the introduction of the Innovation and LTS release model.

MySQL 5.7 在 MySQL 5.7.9 版本实现了全面可用(GA)状态,该版本于 2015 年 10 月 21 日发布用于生产环境。MySQL 5.7 的主动开发于 2023 年 10 月 25 日随着 MySQL 5.7.44 版本的发布而结束。MySQL 5.7 achieved General Availability (GA) status with MySQL 5.7.9, which was released for production use on 21 October 2015. Active development for MySQL 5.7 ended on 25 October 2023 with the MySQL 5.7.44 release.

MySQL 5.6 在 MySQL 5.6.10 版本实现了全面可用(GA)状态,该版本于 2013 年 2 月 5 日发布用于生产环境。MySQL 5.6 的主动开发已结束。MySQL 5.6 achieved General Availability (GA) status with MySQL 5.6.10, which was released for production use on 5 February 2013. Active development for MySQL 5.6 has ended.

MySQL 5.5 在 MySQL 5.5.8 版本实现了全面可用(GA)状态,该版本于 2010 年 12 月 3 日发布用于生产环境。MySQL 5.5 的主动开发已结束。MySQL 5.5 achieved General Availability (GA) status with MySQL 5.5.8, which was released for production use on 3 December 2010. Active development for MySQL 5.5 has ended.

MySQL 5.1 在 MySQL 5.1.30 版本中实现了正式发布(GA)状态,该版本于 2008 年 11 月 14 日发布用于生产环境。MySQL 5.1 的活跃开发已结束。MySQL 5.1 achieved General Availability (GA) status with MySQL 5.1.30, which was released for production use on 14 November 2008. Active development for MySQL 5.1 has ended.

MySQL 5.0 在 MySQL 5.0.15 版本中实现了正式发布(GA)状态,该版本于 2005 年 10 月 19 日发布用于生产环境。MySQL 5.0 的活跃开发已结束。MySQL 5.0 achieved General Availability (GA) status with MySQL 5.0.15, which was released for production use on 19 October 2005. Active development for MySQL 5.0 has ended.

A.1.2.

为什么 MySQL 的版本号跳过了 6 和 7,而直接到 8.0?Why did MySQL version numbering skip versions 6 and 7 and go straight to 8.0?

由于我们在该 MySQL 版本中引入了许多新的重要功能,我们决定启动一个全新的系列。由于 6 和 7 版本号实际上曾被 MySQL 使用过,所以我们直接跳到 8.0。Due to the many new and important features we were introducing in this MySQL version, we decided to start a fresh new series. As the series numbers 6 and 7 had actually been used before by MySQL, we went to 8.0.

A.1.3.

MySQL 可以执行子查询吗?Can MySQL do subqueries?

可以。参见 第 15.2.15 节,“子查询”。Yes. See Section 15.2.15, “Subqueries”.

A.1.4.

MySQL 能执行多表插入、更新和删除操作吗?Can MySQL perform multiple-table inserts, updates, and deletes?

可以。有关执行多表更新所需的语法,请参见第 15.2.17 节,“UPDATE 语句”;有关执行多表删除所需的语法,请参见第 15.2.2 节,“DELETE 语句”。Yes. For the syntax required to perform multiple-table updates, see Section 15.2.17, “UPDATE Statement”; for that required to perform multiple-table deletes, see Section 15.2.2, “DELETE Statement”.

多表插入可以通过触发器实现,其FOR EACH ROW子句在BEGIN ... END块中包含多个INSERT语句。请参见第 27.3 节,“使用触发器”。A multiple-table insert can be accomplished using a trigger whose FOR EACH ROW clause contains multiple INSERT statements within a BEGIN ... END block. See Section 27.3, “Using Triggers”.

A.1.5.

MySQL 有序列吗?Does MySQL have Sequences?

不。然而,MySQL 有一个 AUTO_INCREMENT 系统,它也可以处理多源复制设置中的插入。通过 auto_increment_increment 和 auto_increment_offset 系统变量,你可以设置每个服务器生成的自增值不会与其他服务器冲突。auto_increment_increment 的值应大于服务器数量,并且每个服务器应有唯一的偏移量。No. However, MySQL has an AUTO_INCREMENT system, which can also handle inserts in a multi-source replication setup. With the auto_increment_increment and auto_increment_offset system variables, you can set each server to generate auto-increment values that don't conflict with other servers. The auto_increment_increment value should be greater than the number of servers, and each server should have a unique offset.

A.1.6.

MySQL 有带有秒分数的NOW()函数吗?Does MySQL have a NOW() function with fractions of seconds?

有,参见第 13.2.6 节,“时间值中的秒分数”。Yes, see Section 13.2.6, “Fractional Seconds in Time Values”.

A.1.7.

MySQL 支持多核处理器吗?Does MySQL work with multi-core processors?

支持。MySQL 是完全多线程的,并且会使用提供给它的所有 CPU。并非所有 CPU 都可能可用;现代操作系统应能够利用所有底层 CPU,同时也使得可以将进程限制在特定 CPU 或 CPU 集合上。Yes. MySQL is fully multithreaded, and makes use of all CPUs made available to it. Not all CPUs may be available; modern operating systems should be able to utilize all underlying CPUs, but also make it possible to restrict a process to a specific CPU or sets of CPUs.

在 Windows 上,当前 mysqld 可以使用的(逻辑)处理器数量是有限的:一个单独的处理器组,最多可包含 64 个逻辑处理器。On Windows, there is currently a limit to the number of (logical) processors that mysqld can use: a single processor group, which is limited to a maximum of 64 logical processors.

多核的使用情况可能如下:Use of multiple cores may be seen in these ways:

  • 通常,一个核心用于处理来自一个会话发出的命令。A single core is usually used to service the commands issued from one session.

  • 少数后台线程会有限地使用额外的核心;例如,用于使后台 I/O 任务继续进行。A few background threads make limited use of extra cores; for example, to keep background I/O tasks moving.

  • 如果数据库是 I/O 限制的(CPU 使用率低于容量),增加更多 CPU 是徒劳的。如果数据库被分为 I/O 限制部分和 CPU 限制部分,增加 CPU 仍可能是有用的。If the database is I/O-bound (indicated by CPU consumption less than capacity), adding more CPUs is futile. If the database is partitioned into an I/O-bound part and a CPU-bond part, adding CPUs may still be useful.

A.1.8.

为什么我会看到多个 mysqld 进程?Why do I see multiple processes for mysqld?

mysqld 是单进程程序,而不是多进程程序,也不会分叉或启动其他进程。然而,mysqld 是多线程的,一些进程报告系统工具会为多线程进程的每个线程显示单独条目,这可能会导致看起来有多个 mysqld 进程,而实际上只有一个。mysqld is a single-process program, not a multi-process program, and does not fork or launch other processes. However, mysqld is multithreaded and some process-reporting system utilities display separate entries for each thread of multithreaded processes, which may lead to the appearance of multiple mysqld processes when in fact there is only one.

A.1.9.

MySQL 可以执行 ACID 事务吗?Can MySQL perform ACID transactions?

可以。所有当前版本的 MySQL 都支持事务。InnoDB存储引擎提供完整的 ACID 事务,具有行级锁、多版本控制、非锁定可重复读以及所有四个 SQL 标准隔离级别。Yes. All current MySQL versions support transactions. The InnoDB storage engine offers full ACID transactions with row-level locking, multi-versioning, nonlocking repeatable reads, and all four SQL standard isolation levels.

NDB存储引擎仅支持READ COMMITTED事务隔离级别。The NDB storage engine supports the READ COMMITTED transaction isolation level only.