MySQL SLES 存储库提供 RPM 软件包,用于在 SUSE Enterprise Linux Server 上安装和管理 MySQL 服务器、客户端和其他组件。本节包含有关获取和安装这些软件包的信息。The MySQL SLES repository provides RPM packages for installing and managing the MySQL server, client, and other components on SUSE Enterprise Linux Server. This section contains information on obtaining and installing these packages.
为您的系统存储库列表添加或更新官方 MySQL SLES 存储库:Add or update the official MySQL SLES repository for your system's repository list:
配置文件名的开头部分(例如 mysql84)描述了启用安装的默认 MySQL 系列。在这种情况下,默认启用 MySQL 8.4 LTS 的子存储库。它还包含其他子存储库版本,例如 MySQL 8.0 和 MySQL Innovation Series。The beginning part of the configuration file name, such as
mysql84, describes
the default MySQL series that is enabled for installation. In
this case, the subrepository for MySQL 8.4 LTS
is enabled by default. It also contains other subrepository
versions, such as MySQL 8.0 and the MySQL
Innovation Series.
新 MySQL 存储库安装New MySQL Repository Installation
如果系统上尚未存在 MySQL 存储库,则:If the MySQL repository is not yet present on the system then:
转到 MySQL SLES 存储库的下载页面,网址为 https://dev.mysql.com/downloads/repo/suse/。Go to the download page for MySQL SLES repository at https://dev.mysql.com/downloads/repo/suse/.
选择并下载适合您的 SLES 版本的发行包。Select and download the release package for your SLES version.
使用以下命令安装下载的发行包,并将
package-name替换为下载的包的名称:Install the downloaded release package with the following command, replacingpackage-namewith the name of the downloaded package:$>
sudo rpm -Uvhpackage-name.rpm例如,要安装 SLES 15 包,其中
#表示版本中的版本号,例如15-1:For example, to install the SLES 15 package where#indicates the release number within a version such as15-1:$>
sudo rpm -Uvh mysql84-community-release-sl15-#.noarch.rpm
更新现有 MySQL 存储库安装Update an Existing MySQL Repository Installation
如果旧版本已存在,则更新它:If an older version is already present then update it:
$>
sudo zypper update mysql84-community-release虽然这不是每个 MySQL 版本都需要的,但它会更新 MySQL 存储库信息以包含当前信息。例如,
mysql84-community-release-sl15-是第一个 SUSE 15 存储库配置文件,它添加了从 MySQL 8.1 开始的创新版本轨道。Although this is not required for each MySQL release, it does update MySQL repository information to include the current information. For example,7.noarch.rpmmysql84-community-release-sl15-is the first SUSE 15 repository configuration file that adds the innovation release track that begins with MySQL 8.1. series.7.noarch.rpm
在 MySQL SLES 存储库中,MySQL 社区服务器的不同版本系列托管在不同的子存储库中。默认情况下启用最新错误修复系列(当前为 MySQL 8.4)的子存储库,并禁用所有其他系列的子存储库。使用此命令查看 MySQL SLES 存储库中的所有子存储库,并查看其中哪些子存储库已启用或禁用:Within the MySQL SLES repository, different release series of the MySQL Community Server are hosted in different subrepositories. The subrepository for the latest bugfix series (currently MySQL 8.4) is enabled by default, and the subrepositories for all other series are disabled. Use this command to see all of the subrepositories in the MySQL SLES repository, and to see which of them are enabled or disabled:
$> zypper repos | grep mysql.*community
创新轨道可用于 SLES 15,其中包含 mysql-innovation-community 等条目。The innovation track is available for SLES 15 with entries such as
mysql-innovation-community.
要安装特定系列的最新版本,在运行安装命令之前,请确保启用所需系列的子存储库并禁用其他系列的子存储库。例如,在 SLES 15 上,要禁用默认启用的 MySQL 8.4 服务器和工具的子存储库,请使用以下命令:To install the latest release from a specific series, before running the installation command, make sure that the subrepository for the series you want is enabled and the subrepositories for other series are disabled. For example, on SLES 15, to disable the subrepositories for MySQL 8.4 server and tools, which are enabled by default, use the following:
$>sudo zypper modifyrepo -d mysql-8.4-lts-community$>sudo zypper modifyrepo -d mysql-tools-community
然后,启用所需版本系列的子存储库。例如,要在 SLES 15 上启用创新跟踪:Then, enable the subrepositories for the release series you want. For example, to enable the Innovation track on SLES 15:
$>sudo zypper modifyrepo -e mysql-innovation-community$>sudo zypper modifyrepo -e mysql-tools-innovation-community
您在任何时候都应该只为一个版本系列启用子存储库。You should only enable a subrepository for one release series at any time.
通过运行以下命令并检查其输出来验证是否已启用正确的子存储库:Verify that the correct subrepositories have been enabled by running the following command and checking its output:
$> zypper repos -E | grep mysql.*community
7 | mysql-connectors-community | MySQL Connectors Community | Yes | (r ) Yes | No
10 | mysql-innovation-community | MySQL Innovation Release Community Server | Yes | (r ) Yes | No
16 | mysql-tools-innovation-community | MySQL Tools Innovation Community | Yes | ( p) Yes | No
之后,使用以下命令刷新已启用子存储库的存储库信息:After that, use the following command to refresh the repository information for the enabled subrepository:
$> sudo zypper refresh
启用官方 MySQL 存储库后,安装 MySQL 服务器:With the official MySQL repository enabled, install MySQL Server:
$> sudo zypper install mysql-community-server
这将安装 MySQL 服务器的软件包以及其他必需的软件包。This installs the package for the MySQL server, as well as other required packages.
使用以下命令启动 MySQL 服务器:Start the MySQL server with the following command:
$> systemctl start mysql
可以使用以下命令检查 MySQL 服务器的状态:You can check the status of the MySQL server with the following command:
$> systemctl status mysql
如果操作系统启用了 systemd,则使用标准 systemctl(或者参数相反的 service)命令,例如 stop、start、status和restart应用于管理 MySQL 服务器服务。 mysql 服务默认启用,并在系统重新启动时启动。有关更多信息,请参阅第 2.5.9 节“使用 systemd 管理 MySQL 服务器”。If the operating system is systemd enabled, standard
systemctl (or alternatively,
service with the arguments reversed) commands
such as stop, start,
status, and restart should
be used to manage the MySQL server service. The
mysql service is enabled by default, and it
starts at system reboot. See Section 2.5.9, “Managing MySQL Server with systemd” for
additional information.
MySQL 服务器初始化:服务器第一次启动时,会初始化服务器,并会发生以下情况(如果初始化过程开始时服务器的数据目录为空):MySQL Server Initialization: When the server is started for the first time, the server is initialized, and the following happens (if the data directory of the server is empty when the initialization process begins):
在数据目录中生成 SSL 证书和密钥文件。The SSL certificate and key files are generated in the data directory.
validate_password 插件已安装并启用。The validate_password plugin is installed and enabled.
超级用户帐户
'root'@'localhost'已创建。设置超级用户的密码并将其存储在错误日志文件中。要显示它,请使用以下命令:A superuser account'root'@'localhost'is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:$>
sudo grep 'temporary password' /var/log/mysql/mysqld.log使用生成的临时密码登录并为超级用户帐户设置自定义密码,尽快更改 root 密码:Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:
$>
mysql -uroot -pmysql>
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
MySQL 的 validate_password 插件是默认安装的。这将要求密码至少包含 1 个大写字母、1 个小写字母、1 个数字和 1 个特殊字符,并且密码总长度至少为 8 个字符。MySQL's validate_password plugin is installed by default. This will require that passwords contain at least one uppercase letter, one lowercase letter, one digit, and one special character, and that the total password length is at least 8 characters.
您可以使用以下命令停止 MySQL 服务器:You can stop the MySQL Server with the following command:
$> sudo systemctl stop mysql
您可以安装更多 MySQL 组件。使用以下命令列出 MySQL SLES 存储库中的子存储库:You can install more components of MySQL. List subrepositories in the MySQL SLES repository with the following command:
$> zypper repos | grep mysql.*community
使用以下命令列出可用于特定子存储库的 MySQL 组件的软件包,将 subrepo-name 更改为您感兴趣的子存储库的名称:Use the following command to list the packages for the MySQL
components available for a certain subrepository, changing
subrepo-name to the name of the
subrepository you are interested in :
$> zypper packages subrepo-name
使用以下命令安装您选择的任何软件包,替换 package-name 包含软件包名称(您可能需要首先启用软件包的子存储库,使用与选择发行版中概述的为特定发行系列选择子存储库相同的方法系列):Install any packages of your choice with the following command,
replacing package-name with name of the
package (you might need to enable first the subrepository for the
package, using the same method for selecting a subrepository for a
specific release series outlined in
Selecting a Release Series):
$> sudo zypper install package-name
例如,要从已启用的发行系列的子存储库安装 MySQL 基准套件:For example, to install the MySQL benchmark suite from the subrepository for the release series you have already enabled:
$> sudo zypper install mysql-community-bench
在对 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 SLES 存储库对您的 MySQL 安装执行就地更新(即替换旧版本的服务器,然后使用旧数据文件运行新版本)(假设您已经使用 MySQL SLES 存储库安装了 MySQL;如果不是这种情况,请按照 替换由其他来源的 RPM 安装的 MySQL):Use the MySQL SLES repository to perform an in-place update (that is, replacing the old version of the server and then running the new version using the old data files) for your MySQL installation by following these steps (they assume you have installed MySQL with the MySQL SLES repository; if that is not the case, following the instructions in Replacing MySQL Installed by an RPM from Other Sources instead):
选择目标系列Selecting a Target Series
在更新操作期间,默认情况下,MySQL SLES 存储库会将 MySQL 更新到最新版本您在安装过程中选择的发行系列中的版本(有关详细信息,请参阅选择发行系列),这意味着。例如,错误修复系列安装(例如 8.4)不会更新到创新系列(例如 9.6)。要更新到另一个版本系列,您需要首先禁用已选择的系列的子存储库(默认情况下,或您自己),然后启用目标系列的子存储库。为此,请按照选择发行系列中给出的一般说明进行操作。During an update operation, by default, the MySQL SLES repository updates MySQL to the latest version in the release series you have chosen during installation (see Selecting a Release Series for details), which means. For example, a bugfix series installation, such as 8.4, will not update to an innovation series, such as 9.6. To update to another release series, you need to 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, follow the general instructions given in Selecting a Release Series.
一般规则是,要从一个发行系列升级到另一个发行系列,请转到下一个系列,而不是跳过一个系列。As a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series.
ImportantMySQL 不支持就地降级 MySQL SLES 存储库。请按照第 4 章降级 MySQL 中的说明进行操作。In-place downgrading of MySQL is not supported by the MySQL SLES repository. Follow the instructions in Chapter 4, Downgrading MySQL.
升级 MySQLUpgrading MySQL
通过以下命令升级 MySQL 及其组件:Upgrade MySQL and its components by the following command:
$>
sudo zypper update mysql-community-server或者,您可以通过告诉 Zypper 更新来更新 MySQL 系统上的所有内容(这可能需要更多时间):Alternatively, you can update MySQL by telling Zypper to update everything on your system (this might take considerably more time):
$>
sudo zypper update
您也可以仅更新特定组件。使用以下命令列出 MySQL SLES 存储库中所有已安装的软件包:You can also update a specific component only. Use the following command to list all the installed packages from the MySQL SLES repository:
$> zypper packages -i | grep mysql-.*community
确定您选择的组件的软件包名称后,使用以下命令更新软件包,将 package-name 替换为软件包的名称: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:
$> sudo zypper update package-name
用于安装 MySQL 社区服务器及其组件的 RPM 可以从 MySQL 下载,可以从 MySQL 开发人员专区、从 SLES 的本机软件存储库或从 MySQL SLES 存储库下载。这些来源的 RPM 可能不同,并且它们可能以不同的方式安装和配置 MySQL。RPMs for installing the MySQL Community Server and its components can be downloaded from MySQL either from the MySQL Developer Zone, from the native software repository of SLES, or from the MySQL SLES repository. The RPMs from the those sources might be different, and they might install and configure MySQL in different ways.
如果您使用 MySQL 开发人员专区或 SLES 本地软件存储库中的 RPM 安装了 MySQL,并且希望使用 MySQL SLES 存储库中的 RPM 替换安装,请按照以下步骤操作:If you have installed MySQL with RPMs from the MySQL Developer Zone or the native software repository of SLES and want to replace the installation using the RPM from the MySQL SLES repository, follow these steps:
备份数据库以避免数据丢失。请参阅第 9 章,备份与恢复了解如何执行此操作。Back up your database to avoid data loss. See Chapter 9, Backup and Recovery on how to do that.
停止您的 MySQL 服务器(如果它正在运行)。如果服务器作为服务运行,您可以使用以下命令停止它:Stop your MySQL Server, if it is running. If the server is running as a service, you can stop it with the following command:
$>
systemctl stop mysql按照添加 MySQL SLES 存储库的步骤进行操作。Follow the steps given for Adding the MySQL SLES Repository.
按照选择发行系列。Follow the steps given for Selecting a Release Series.
按照使用 Zypper 安装 MySQL 给出的步骤进行操作 Zypper。系统会询问您是否要使用新软件包替换旧软件包;例如:Follow the steps given for Installing MySQL with Zypper. You will be asked if you want to replace the old packages with the new ones; for example:
Problem: mysql-community-server-5.6.22-2.sles11.x86_64 requires mysql-community-client = 5.6.22-2.sles11, but this requirement cannot be provided uninstallable providers: mysql-community-client-5.6.22-2.sles11.x86_64[mysql56-community] Solution 1: replacement of mysql-client-5.5.31-0.7.10.x86_64 with mysql-community-client-5.6.22-2.sles11.x86_64 Solution 2: do not install mysql-community-server-5.6.22-2.sles11.x86_64 Solution 3: break mysql-community-server-5.6.22-2.sles11.x86_64 by ignoring some of its dependencies Choose from above solutions by number or cancel [1/2/3/c] (c)
选择“替换”选项(示例中的“解决方案 1”)从 MySQL SLES 存储库完成安装。Choose the “replacement” option (“Solution 1” in the example) to finish your installation from the MySQL SLES repository.
以下说明假设您的系统上尚未安装 MySQL Server 和 MySQL NDB Cluster;如果不是这种情况,请在继续之前删除 MySQL Server 或 MySQL NDB Cluster,包括其所有可执行文件、库、配置文件、日志文件和数据目录。但是,无需删除可能用于在系统上启用 MySQL SLES 存储库的发行包。The following instructions assume that neither the MySQL Server nor MySQL NDB Cluster has already been installed on your system; if that is not the case, remove the MySQL Server or MySQL NDB Cluster, including all its executables, libraries, configuration files, log files, and data directories, before you continue. However there is no need to remove the release package you might have used to enable the MySQL SLES repository on your system.
NDB Cluster Auto-Installer 包依赖于
python2-crypto和python-paramiko包。如果系统上已启用 Python 存储库,Zypper 可以处理此依赖性。The NDB Cluster Auto-Installer package has a dependency on thepython2-cryptoandpython-paramikopackages. Zypper can take care of this dependency if the Python repository has been enabled on your system.
在 MySQL SLES 存储库中,MySQL 社区服务器和 MySQL NDB Cluster 托管在不同的子存储库中。默认情况下,MySQL Server 最新错误修复系列的子存储库处于启用状态,MySQL NDB Cluster 的子存储库处于禁用状态。要安装 NDB Cluster,请禁用 MySQL Server 的子存储库并启用 NDB Cluster 的子存储库。例如,使用以下命令禁用默认启用的 MySQL 8.4 的子存储库:Within the MySQL SLES repository, the MySQL Community Server and MySQL NDB Cluster are hosted in different subrepositories. By default, the subrepository for the latest bugfix series of the MySQL Server is enabled and the subrepository for MySQL NDB Cluster is disabled. To install NDB Cluster, disable the subrepository for the MySQL Server and enable the subrepository for NDB Cluster. For example, disable the subrepository for MySQL 8.4, which is enabled by default, with the following command:
$> sudo zypper modifyrepo -d mysql-8.4-lts-community
然后,启用 MySQL NDB Cluster 的子存储库:Then, enable the subrepository for MySQL NDB Cluster:
$> sudo zypper modifyrepo -e mysql-cluster-8.4-community
通过运行以下命令并检查其输出来验证是否已启用正确的子存储库:Verify that the correct subrepositories have been enabled by running the following command and checking its output:
$> zypper repos -E | grep mysql.*community
10 | mysql-cluster-8.4-community | MySQL Cluster 8.4 Community | Yes | No 之后,使用以下命令刷新已启用子存储库的存储库信息:After that, use the following command to refresh the repository information for the enabled subrepository:
$> sudo zypper refresh
对于 MySQL NDB Cluster 的最小安装,请按照以下步骤操作:For a minimal installation of MySQL NDB Cluster, follow these steps:
安装 SQL 节点组件:Install the components for SQL nodes:
$>
sudo zypper install mysql-cluster-community-server安装完成后,按照启动 MySQL 中的步骤启动并初始化 SQL 节点服务器。After the installation is completed, start and initialize the SQL node by following the steps given in Starting the MySQL Server.
如果您选择使用
mysqld --initialize命令手动初始化数据目录(详细信息请参见第 2.9.1 节“初始化数据目录”),将会生成一个root密码,并且存储在 SQL 节点的错误日志中;请参阅 启动 MySQL Server 了解如何查找密码以及您需要了解的一些信息。If you choose to initialize the data directory manually using themysqld --initializecommand (see Section 2.9.1, “Initializing the Data Directory” for details), arootpassword is going to be generated and stored in the SQL node's error log; see Starting the MySQL Server for how to find the password, and for a few things you need to know about it.
安装管理节点的可执行文件:Install the executables for management nodes:
$>
sudo zypper install mysql-cluster-community-management-server安装数据节点的可执行文件:Install the executables for data nodes:
$>
sudo zypper install mysql-cluster-community-data-node
要安装更多 NDB Cluster 组件,请参阅 安装其他 MySQL 产品和组件。To install more NDB Cluster components, see Installing Additional MySQL Products and Components.
请参阅第 25.3.3 节“NDB Cluster 的初始配置”了解如何操作配置 MySQL NDB Cluster 和第 25.3.4 节“NDB Cluster 初始启动”了解如何首次启动它。See Section 25.3.3, “Initial Configuration of NDB Cluster” on how to configure MySQL NDB Cluster and Section 25.3.4, “Initial Startup of NDB Cluster” on how to start it for the first time.
您可以使用 Zypper 从 MySQL SLES 存储库安装 MySQL NDB Cluster 的各个组件和附加产品。为此,假设您的系统存储库列表中已存在 MySQL SLES 存储库(如果没有,请按照使用 SLES 存储库安装 MySQL NDB Cluster 的步骤 1 和 2 进行操作),请按照 安装其他 MySQL NDB Cluster 产品和组件。You can use Zypper to install individual components and additional products of MySQL NDB Cluster from the MySQL SLES repository. To do that, assuming you already have the MySQL SLES repository on your system's repository list (if not, follow Step 1 and 2 of Installing MySQL NDB Cluster Using the SLES Repository), follow the same steps given in Installing Additional MySQL NDB Cluster Products and Components.
已知问题: 目前,在安装测试套件时,并非会自动安装运行 MySQL NDB Cluster 测试套件所需的所有组件包(mysql-cluster-community-test)。在运行测试套件之前,使用 zypper install 安装以下软件包:Known issue: Currently, not all
components required for running the MySQL NDB Cluster test suite are
installed automatically when you install the test suite
package (mysql-cluster-community-test).
Install the following packages with zypper
install before you run the test suite:
mysql-cluster-community-auto-installermysql-cluster-community-auto-installermysql-cluster-community-management-servermysql-cluster-community-management-servermysql-cluster-community-data-nodemysql-cluster-community-data-nodemysql-cluster-community-memcachedmysql-cluster-community-memcachedmysql-cluster-community-javamysql-cluster-community-javamysql-cluster-community-ndbclient-develmysql-cluster-community-ndbclient-devel