要在 Windows 上升级 MySQL,可以下载并执行最新的 MySQL Server MSI,或者使用 Windows ZIP 压缩包分发版。To upgrade MySQL on Windows, either download and execute the latest MySQL Server MSI or use the Windows ZIP archive distribution.
与 MySQL 8.4 不同,MySQL 8.0 使用 MySQL 安装程序来安装和升级 MySQL Server 及大多数其他 MySQL 产品;但 MySQL 安装程序在 MySQL 8.1 及更高版本中不可用。然而,MySQL 安装程序中使用的配置功能自 MySQL 8.1 起可通过 第 2.3.2 节,“配置:使用 MySQL Configurator” 获得,该功能包含在 MSI 和 ZIP 压缩包中。Unlike MySQL 8.4, MySQL 8.0 uses MySQL Installer to install and upgrade MySQL Server along with most other MySQL products; but MySQL Installer is not available with MySQL 8.1 and higher. However, the configuration functionality used in MySQL Installer is available as of MySQL 8.1 using Section 2.3.2, “Configuration: Using MySQL Configurator” that is bundled with both the MSI and Zip archive.
您选择的方法取决于现有安装是如何进行的。在继续之前,请查看第 3 章,升级 MySQL,了解与 Windows 无关的 MySQL 升级的更多信息。The approach you select depends on how the existing installation was performed. Before proceeding, review Chapter 3, Upgrading MySQL for additional information on upgrading MySQL that is not specific to Windows.
下载并执行最新的 MSI。虽然不直接支持在不同发布系列之间升级,但“自定义安装”选项允许定义安装位置,否则 MSI 会安装到标准位置,例如 C:\Program Files\MySQL\MySQL Server
8.4\。Download and execute the latest MSI. Although upgrading between
release series is not directly supported, the "Custom Setup"
option allows defining an installation location as otherwise the
MSI installs to the standard location, such as
C:\Program Files\MySQL\MySQL Server
8.4\.
执行 MySQL Configurator 来配置您的安装。Execute MySQL Configurator to configure your installation.
要使用 Windows ZIP 存档分发版本进行升级:To perform an upgrade using the Windows ZIP archive distribution:
从 https://dev.mysql.com/downloads/ 下载 MySQL 最新的 Windows ZIP 压缩包发行版。Download the latest Windows ZIP Archive distribution of MySQL from https://dev.mysql.com/downloads/.
如果服务器正在运行,请将其停止。如果服务器安装为服务,请在命令提示符下使用以下命令停止该服务:If the server is running, stop it. If the server is installed as a service, stop the service with the following command from the command prompt:
C:\>
SC STOPmysqld_service_name或者,使用 NET STOP
mysqld_service_name。Alternatively, use NET STOPmysqld_service_name.如果您没有以服务的方式运行 MySQL 服务器,请使用 mysqladmin 来停止它。例如,在从 MySQL 8.3 升级到 8.4 之前,请按如下方式使用 MySQL 8.3 的 mysqladmin:If you are not running the MySQL server as a service, use mysqladmin to stop it. For example, before upgrading from MySQL 8.3 to 8.4, use mysqladmin from MySQL 8.3 as follows:
C:\>
"C:\Program Files\MySQL\MySQL Server 8.3\bin\mysqladmin" -u root shutdownNote如果 MySQL
root用户账户有密码,请使用 mysqladmin 命令加上-p选项,并在提示时输入密码。If the MySQLrootuser account has a password, invoke mysqladmin with the-poption and enter the password when prompted.解压 ZIP 压缩包。您可以选择覆盖现有的 MySQL 安装(通常位于
C:\mysql),或者安装到不同的目录,例如C:\mysql8。推荐覆盖现有安装。Extract the ZIP archive. You may either overwrite your existing MySQL installation (usually located atC:\mysql), or install it into a different directory, such asC:\mysql8. Overwriting the existing installation is recommended.重启服务器。例如,如果你以服务方式运行 MySQL,可以使用 SC START
mysqld_service_name或 NET STARTmysqld_service_name命令,否则可以直接调用 mysqld。Restart the server. For example, use the SC STARTmysqld_service_nameor NET STARTmysqld_service_namecommand if you run MySQL as a service, or invoke mysqld directly otherwise.如果遇到错误,请参阅 第 2.3.4 节,“Microsoft Windows MySQL 服务器安装故障排除”。If you encounter errors, see Section 2.3.4, “Troubleshooting a Microsoft Windows MySQL Server Installation”.