8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 3 升级 MySQL / 3.3 升级最佳实践
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

3.3 升级最佳实践3.3 Upgrade Best Practices

MySQL 支持在小版本之间升级(在 LTS 系列内)以及升级到下一个大版本(跨 LTS 系列)。升级提供最新的功能、性能和安全修复。MySQL supports upgrading between minor versions (within an LTS series) and to the next major version (across an LTS series). Upgrading provides the latest features, performance, and security fixes.

为了做好准备并帮助确保您成功升级到最新的 MySQL 版本,我们建议采用以下最佳实践:To prepare and help ensure that your upgrade to the latest MySQL release is successful, we recommend the following best practices:

决定升级的主要或次要版本Decide on Major or Minor Version for Upgrade

MySQL 版本模型区分 LTS(长期支持)和创新版本。 LTS 版本拥有 8 年以上的支持,适用于生产用途。创新版本为用户提供最新的特性和功能。详细了解 MySQL 版本模型。The MySQL Release Model makes a distinction between LTS (Long Term Support) and Innovation Releases. LTS releases have 8+ years of support and are meant for production use. Innovation Releases provide users with the latest features and capabilities. Learn more about the MySQL Release Model.

执行次要版本升级非常简单,而主要版本升级则需要在升级前进行战略规划和额外测试。本指南对于主要版本升级特别有用。Performing a minor version upgrade is straightforward while major version upgrades require strategic planning and additional testing before the upgrade. This guide is especially useful for major version upgrades.

确定升级类型Decide on Upgrade Type

升级 MySQL 主要有以下三种方式:请阅读相关文档以确定哪种类型的升级最适合您的情况。There are three main ways to upgrade MySQL; read the associated documentation to determine which type of upgrade is best suited for your situation.

查看支持的平台Review Supported Platforms

如果新版本的 MySQL 不支持您当前的操作系统,则计划升级操作系统,否则请计划升级操作系统不支持就地升级。If your current operating system is not supported by the new version of MySQL, then plan to upgrade the operating system as otherwise an in-place upgrade is not supported.

有关支持平台的最新列表,请参阅:https://www.mysql.com/support/supportedplatforms/database.htmlFor a current list of supported platforms, see: https://www.mysql.com/support/supportedplatforms/database.html

了解 MySQL Server 更改Understand MySQL Server Changes

每个主要版本都带有新功能、行为更改、弃用和删除。了解其中每一项对现有应用程序的影响非常重要。Each major version comes with new features, changes in behavior, deprecations, and removals. It is important to understand the impact of each of these to existing applications.

请参阅:第 3.5 节“MySQL 8.4 中的更改”。See: Section 3.5, “Changes in MySQL 8.4”.

运行升级检查器并修复不兼容性Run Upgrade Checker and Fix Incompatibilities

MySQL Shell 的升级检查器实用程序会检测数据库版本之间的不兼容性,必须在执行升级之前解决这些不兼容性问题。 util.checkForServerUpgrade() 函数验证 MySQL 服务器实例是否已准备好升级。连接到现有的 MySQL 服务器并选择您计划升级到的 MySQL 服务器版本,以便该实用程序在升级之前报告要解决的问题。其中包括数据类型、存储引擎等方面的不兼容。MySQL Shell's Upgrade Checker Utility detects incompatibilities between database versions that must be addressed before performing the upgrade. The util.checkForServerUpgrade() function verifies that MySQL server instances are ready to upgrade. Connect to the existing MySQL server and select the MySQL Server version you plan to upgrade to for the utility to report issues to address prior to an upgrade. These include incompatibilities in data types, storage engines, and so on.

当升级检查实用程序不再报告任何问题时,您就可以进行升级了。You are ready to upgrade when the upgrade checking utility no longer reports any issues.

在测试环境中运行应用程序Run Applications in a Test Environment

完成升级检查程序的要求后,接下来在新的目标 MySQL 服务器上测试您的应用程序。检查 MySQL 错误日志和应用程序日志中的错误和警告。After completing the upgrade checker's requirements, next test your applications on the new target MySQL server. Check for errors and warnings in the MySQL error log and application logs.

对应用程序和工作负载性能进行基准测试Benchmark Applications and Workload Performance

我们建议通过比较您自己的应用程序和工作负载在使用旧版 MySQL 和新版本 MySQL 时的执行情况来对它们进行基准测试。通常,较新的 MySQL 版本会添加功能并提高性能,但在某些情况下,升级可能会针对特定查询运行速度变慢。可能导致性能下降的问题:We recommend benchmarking your own applications and workloads by comparing how they perform using the previous and new versions of MySQL. Usually, newer MySQL versions add features and improve performance but there are cases where an upgrade might run slower for specific queries. Possible issues resulting in performance regressions:

  • 之前的服务器配置对于新版本来说并非最佳Prior server configuration is not optimal for newer version

  • 数据类型更改Changes to data types

  • 多字节字符集支持需要额外存储Additional storage required by Multi-byte character set support

  • 存储引擎更改Storage engines changes

  • 删除或更改索引Dropped or changed indexes

  • 更强的加密Stronger encryption

  • 更强的身份验证Stronger authentication

  • SQL 优化器更改SQL optimizer changes

  • 新版本 MySQL 需要额外内存Newer version of MySQL require additional memory

  • 物理或虚拟硬件速度较慢 - 计算或存储Physical or Virtual Hardware is slower - compute or storage

有关相关信息和潜在的缓解技术,请参阅有效性能回归。For related information and potential mitigation techniques, see Valid Performance Regressions.

并行运行两个 MySQL 版本Run Both MySQL Versions in Parallel

为了将风险降到最低,最好在运行升级系统的同时保持当前系统运行。To minimize risk, it is best keep the current system running while running the upgraded system in parallel.

进行最终测试升级Run Final Test Upgrade

在升级生产服务器之前进行演练和试运行。在升级生产系统之前,彻底测试升级过程。Practice and do a run though prior to upgrading your production server. Thoroughly test the upgrade procedures before upgrading a production system.

检查 MySQL 备份Check MySQL Backup

在执行升级之前,检查完整备份是否存在且可用。Check that the full backup exists and is viable before performing the upgrade.

升级生产服务器Upgrade Production Server

您已准备好完成升级。You are ready to complete the upgrade.

企业支持Enterprise Support

如果您是 MySQL 企业版客户,还可以联系 MySQL 支持团队的专家,解答您可能遇到的任何问题。If you're a MySQL Enterprise Edition customer, you can also contact the MySQL Support Team experts with any questions you may have.