8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 2 安装 MySQL / 2.7 在 Solaris 上安装 MySQL / 2.7.1 使用 Solaris PKG 在 Solaris 上安装 MySQL
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.7.1 使用 Solaris PKG 在 Solaris 上安装 MySQL2.7.1 Installing MySQL on Solaris Using a Solaris PKG

您可以使用本机 Solaris PKG 格式的二进制包(而不是二进制 tarball)在 Solaris 上安装 MySQLYou can install MySQL on Solaris using a binary package of the native Solaris PKG format instead of the binary tarball distribution.

要使用此软件包,请下载相应的 mysql-VERSION-solaris11-PLATFORM.pkg.gz 文件,然后解压缩。例如:To use this package, download the corresponding mysql-VERSION-solaris11-PLATFORM.pkg.gz file, then uncompress it. For example:

$> gunzip mysql-8.4.9-solaris11-x86_64.pkg.gz

要安装新软件包,请使用 pkgadd 并按照屏幕上的提示进行操作。您必须具有 root 权限才能执行此操作:To install a new package, use pkgadd and follow the onscreen prompts. You must have root privileges to perform this operation:

$> pkgadd -d mysql-8.4.9-solaris11-x86_64.pkg

The following packages are available:
  1  mysql     MySQL Community Server (GPL)
               (i86pc) 8.4.9

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:

PKG 安装程序会安装所需的所有文件和工具,然后初始化数据库(如果不存在)。要完成安装,您应该按照安装末尾的说明中的说明设置 MySQL 的 root 密码。或者,您可以运行安装附带的 mysql_secure_installation 脚本。The PKG installer installs all of the files and tools needed, and then initializes your database if one does not exist. To complete the installation, you should set the root password for MySQL as provided in the instructions at the end of the installation. Alternatively, you can run the mysql_secure_installation script that comes with the installation.

默认情况下,PKG 软件包将 MySQL 安装在根路径 /opt/mysql 下。使用pkgadd时只能更改安装根路径,它可用于在不同的 Solaris 区域中安装 MySQL。如果您需要安装在特定目录中,请使用二进制tar文件分发。By default, the PKG package installs MySQL under the root path /opt/mysql. You can change only the installation root path when using pkgadd, which can be used to install MySQL in a different Solaris zone. If you need to install in a specific directory, use a binary tar file distribution.

pkg安装程序将合适的 MySQL 启动脚本复制到/etc/init.d/mysql中。为了使 MySQL 自动启动和关闭,您应该在该文件和 init 脚本目录之间创建一个链接。例如,为了确保 MySQL 的安全启动和关闭,您可以使用以下命令添加正确的链接:The pkg installer copies a suitable startup script for MySQL into /etc/init.d/mysql. To enable MySQL to startup and shutdown automatically, you should create a link between this file and the init script directories. For example, to ensure safe startup and shutdown of MySQL you could use the following commands to add the right links:

$> ln /etc/init.d/mysql /etc/rc3.d/S91mysql
$> ln /etc/init.d/mysql /etc/rc0.d/K02mysql

要删除 MySQL,安装的软件包名称为mysql。您可以将其与 pkgrm 命令结合使用来删除安装。To remove MySQL, the installed package name is mysql. You can use this in combination with the pkgrm command to remove the installation.

要在使用 Solaris 软件包文件格式时进行升级,必须先删除现有安装,然后再安装更新的软件包。删除软件包不会删除现有的数据库信息,只会删除服务器、二进制文件和支持文件。因此,典型的升级顺序是:To upgrade when using the Solaris package file format, you must remove the existing installation before installing the updated package. Removal of the package does not delete the existing database information, only the server, binaries and support files. The typical upgrade sequence is therefore:

$> mysqladmin shutdown
$> pkgrm mysql
$> pkgadd -d mysql-8.4.9-solaris11-x86_64.pkg
$> mysqld_safe &

在执行任何升级之前,您应该检查第 3 章,升级 MySQL 中的注释。You should check the notes in Chapter 3, Upgrading MySQL before performing any upgrade.