8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 3 升级 MySQL / 3.8 使用 MySQL Yum 存储库升级 MySQL
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

3.8 使用 MySQL Yum 仓库升级 MySQL3.8 Upgrading MySQL with the MySQL Yum Repository

对于受支持的基于 Yum 的平台(请参见 第 2.5.1 节,“使用 MySQL Yum 仓库在 Linux 上安装 MySQL”,查看列表),您可以使用 MySQL Yum 仓库执行 MySQL 的原地升级(即替换旧版本,然后使用旧数据文件运行新版本)。For supported Yum-based platforms (see Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”, for a list), you can perform an in-place upgrade for MySQL (that is, replacing the old version and then running the new version using the old data files) with the MySQL Yum repository.

Notes
  • 像 MySQL 9.6 这样的创新系列与像 MySQL 8.4 这样的 LTS 系列处于不同的版本轨道。LTS 系列默认处于活动状态。An innovation series, such as MySQL 9.6, is in a separate track than an LTS series, such as MySQL 8.4. The LTS series is active by default.

  • 在对 MySQL 进行任何更新之前,请仔细遵循第 3 章,升级 MySQL 中的说明。在此处讨论的其他说明中,在更新之前备份数据库尤为重要。Before performing any update to MySQL, follow carefully the instructions in Chapter 3, Upgrading MySQL. Among other instructions discussed there, it is especially important to back up your database before the update.

  • 以下说明假设您已经通过 MySQL Yum 仓库安装了 MySQL,或直接从 MySQL 开发者专区的 MySQL 下载页面 下载 RPM 包进行安装;如果没有,请按照 替换 MySQL 的本地第三方发行版 中的说明进行操作。The following instructions assume you have installed MySQL with the MySQL Yum repository or with an RPM package directly downloaded from MySQL Developer Zone's MySQL Download page; if that is not the case, following the instructions in Replacing a Native Third-Party Distribution of MySQL.

  1. 选择目标系列Selecting a Target Series

    默认情况下,MySQL Yum 仓库会将 MySQL 更新到您在安装过程中选择的发行版本系列中的最新版本(详情见 选择发行版本系列),这意味着,例如,8.0.x 的安装 不会 自动更新到 8.4.x 版本。要更新到另一个发行版本系列,您必须首先禁用已选择系列的子仓库(默认或您自己选择的),并启用目标系列的子仓库。有关如何进行此操作,请参见 选择发行版本系列 中关于编辑 /etc/yum.repos.d/mysql-community.repo 文件中子仓库条目的通用说明。By default, the MySQL Yum repository updates MySQL to the latest version in the release track you have chosen during installation (see Selecting a Release Series for details), which means, for example, a 8.0.x installation is not updated to a 8.4.x release automatically. To update to another release series, you must first disable the subrepository for the series that has been selected (by default, or by yourself) and enable the subrepository for your target series. To do that, see the general instructions given in Selecting a Release Series for editing the subrepository entries in the /etc/yum.repos.d/mysql-community.repo file.

    一般来说,要从一个修复系列升级到另一个修复系列,应升级到下一个修复系列,而不是跳过一个修复系列。例如,如果您当前运行的是 MySQL 5.7 并希望升级到 MySQL 8.4,请先升级到 MySQL 8.0,然后再升级到 MySQL 8.4。有关更多详细信息,请参见 第 3.5 节,“MySQL 8.4 中的更改”。As a general rule, to upgrade from one bugfix series to another, go to the next bugfix series rather than skipping a bugfix series. For example, if you are currently running MySQL 5.7 and wish to upgrade to MySQL 8.4, upgrade to MySQL 8.0 first before upgrading to MySQL 8.4. For additional details, see Section 3.5, “Changes in MySQL 8.4”.

  2. 升级 MySQLUpgrading MySQL

    使用标准的 yum(或 dnf)命令升级 MySQL 组件,例如 MySQL 服务器:Upgrade MySQL components using standard yum (or dnf) commands, such as MySQL Server:

    sudo yum update mysql-server
    

    对于启用 dnf 的平台:For platforms that are dnf-enabled:

    sudo dnf upgrade mysql-server
    

    或者,您可以告诉 Yum 更新系统上的所有内容来更新 MySQL,这可能需要相当多的时间。对于未启用 dnf 的平台:Alternatively, you can update MySQL by telling Yum to update everything on your system, which might take considerably more time. For platforms that are not dnf-enabled:

    sudo yum update
    

    对于启用 dnf 的平台:For platforms that are dnf-enabled:

    sudo dnf upgrade
    
    Note

    MySQL 服务器在通过 Yum 更新后总是会重启。The MySQL server always restarts after an update by Yum.

您也可以只更新特定组件。使用以下命令列出 MySQL 组件的所有已安装包(对于支持 dnf 的系统,请将命令中的 yum 替换为 dnf):You can also update only a specific component. Use the following command to list all the installed packages for the MySQL components (for dnf-enabled systems, replace yum in the command with dnf):

sudo yum list installed | grep "^mysql"

在确定所选组件的包名后,使用以下命令更新该包,将 package-name 替换为包的名称。对于不支持 dnf 的平台:After identifying the package name of the component of your choice, update the package with the following command, replacing package-name with the name of the package. For platforms that are not dnf-enabled:

sudo yum update package-name
  

对于支持 dnf 的平台:For dnf-enabled platforms:

sudo dnf upgrade package-name
  

升级共享客户端库Upgrading the Shared Client Libraries

在使用 Yum 仓库更新 MySQL 后,使用较旧版本共享客户端库编译的应用程序应继续正常工作。After updating MySQL using the Yum repository, applications compiled with older versions of the shared client libraries should continue to work.

如果你重新编译应用程序并使用更新的库进行动态链接: 通常情况下,当共享库的新版本在符号版本之间存在差异或新增功能时(例如,在较新的标准 8.4 共享客户端库与某些较旧的——先前的或变体的——由 Linux 发行版的软件仓库原生提供的共享库版本,或来自其他来源之间),任何使用更新的、较新共享库编译的应用程序在部署到系统时都需要这些更新的库。如预期的那样,如果这些库未安装,依赖这些共享库的应用程序将无法运行。因此,请确保在这些系统上部署 MySQL 的共享库软件包。为此,请将 MySQL Yum 仓库添加到系统中(参见添加 MySQL Yum 仓库),并按照使用 Yum 安装额外的 MySQL 产品和组件给出的说明安装最新的共享库。If you recompile applications and dynamically link them with the updated libraries: As typical with new versions of shared libraries where there are differences or additions in symbol versioning between the newer and older libraries (for example, between the newer, standard 8.4 shared client libraries and some older—prior or variant—versions of the shared libraries shipped natively by the Linux distributions' software repositories, or from some other sources), any applications compiled using the updated, newer shared libraries require those updated libraries on systems where the applications are deployed. As expected, if those libraries are not in place, the applications requiring the shared libraries fail. For this reason, be sure to deploy the packages for the shared libraries from MySQL on those systems. To do this, add the MySQL Yum repository to the systems (see Adding the MySQL Yum Repository) and install the latest shared libraries using the instructions given in Installing Additional MySQL Products and Components with Yum.