8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 2 安装 MySQL / 2.4 在 macOS 上安装 MySQL / 2.4.2 使用原生包在 macOS 上安装 MySQL
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.4.2 使用本机软件包在 macOS 上安装 MySQL2.4.2 Installing MySQL on macOS Using Native Packages

软件包位于磁盘映像内(.dmg) 文件,您首先需要通过在 Finder 中双击其图标来安装该文件。然后,它应该装载映像并显示其内容。The package is located inside a disk image (.dmg) file that you first need to mount by double-clicking its icon in the Finder. It should then mount the image and display its contents.

Note

在继续安装之前,请务必使用 MySQL 管理器应用程序(在 macOS 服务器上)、首选项窗格或命令中的mysqladmin shutdown 来停止所有正在运行的 MySQL 服务器实例Before proceeding with the installation, be sure to stop all running MySQL server instances by using either the MySQL Manager Application (on macOS Server), the preference pane, or mysqladmin shutdown on the command line.

要使用软件包安装程序安装 MySQL:To install MySQL using the package installer:

  1. 下载包含 MySQL 软件包安装程序的磁盘映像 (.dmg) 文件(社区版本位于此处)。双击该文件以挂载磁盘映像并查看其内容。Download the disk image (.dmg) file (the community version is available here) that contains the MySQL package installer. Double-click the file to mount the disk image and see its contents.

    双击磁盘中的 MySQL 安装程序包。它根据您下载的 MySQL 版本命名。例如,对于 MySQL 服务器 8.4.9,它可能被命名为 mysql-8.4.9-macos-10.13-x86_64.pkg。Double-click the MySQL installer package from the disk. It is named according to the version of MySQL you have downloaded. For example, for MySQL server 8.4.9 it might be named mysql-8.4.9-macos-10.13-x86_64.pkg.

  2. 初始向导介绍屏幕引用要安装的 MySQL 服务器版本。单击继续开始安装。The initial wizard introduction screen references the MySQL server version to install. Click Continue to begin the installation.

    MySQL 社区版显示相关 GNU 通用公共许可证的副本。单击继续,然后同意继续。The MySQL community edition shows a copy of the relevant GNU General Public License. Click Continue and then Agree to continue.

  3. 在安装类型页面中,您可以单击安装使用所有默认值执行安装向导,单击自定义更改要安装的组件(MySQL 服务器、MySQL 测试、首选项)窗格、Launchd Support - 默认情况下启用除 MySQL Test 之外的所有选项)。From the Installation Type page you can either click Install to execute the installation wizard using all defaults, click Customize to alter which components to install (MySQL server, MySQL Test, Preference Pane, Launchd Support -- all but MySQL Test are enabled by default).

    Note

    尽管更改安装位置选项可见,但安装位置无法更改。Although the Change Install Location option is visible, the installation location cannot be changed.

    图 2.5 MySQL 软件包安装程序向导:自定义Figure 2.5 MySQL Package Installer Wizard: Customize

    Customize shows three package name options: MySQL Server, MySQL Test, Preference Pane, and Launchd Support. All three options are checked.

  4. 点击安装安装 MySQL 服务器。如果升级当前的 MySQL Server 安装,则安装过程到此结束,否则请按照向导的附加配置步骤安装新的 MySQL Server。Click Install to install MySQL Server. The installation process ends here if upgrading a current MySQL Server installation, otherwise follow the wizard's additional configuration steps for your new MySQL Server installation.

  5. 成功安装新的 MySQL Server 后,通过定义 root 密码并在启动时启用(或禁用)MySQL 服务器来完成配置。After a successful new MySQL Server installation, complete the configuration by defining the root password and enabling (or disabling) the MySQL server at startup.

  6. 为 root 用户定义密码,并在配置步骤完成后切换 MySQL Server 是否应启动。Define a password for the root user, and also toggle whether MySQL Server should start after the configuration step is complete.

  7. 摘要是最后一步并引用成功且完整的 MySQL 服务器安装。 关闭向导。Summary is the final step and references a successful and complete MySQL Server installation. Close the wizard.

MySQL 服务器现已安装。如果您选择不启动 MySQL,则可以从命令行使用 launchctl,或者使用 MySQL 首选项窗格单击“启动”来启动 MySQL。有关其他信息,请参阅第 2.4.3 节“安装和使用 MySQL 启动守护程序”和第 2.4.4 节, “安装和使用 MySQL 首选项窗格”。使用 MySQL 首选项窗格或 launchd 将 MySQL 配置为在启动时自动启动。MySQL server is now installed. If you chose to not start MySQL, then use either launchctl from the command line or start MySQL by clicking "Start" using the MySQL preference pane. For additional information, see Section 2.4.3, “Installing and Using the MySQL Launch Daemon”, and Section 2.4.4, “Installing and Using the MySQL Preference Pane”. Use the MySQL Preference Pane or launchd to configure MySQL to automatically start at bootup.

使用软件包安装程序进行安装时,文件将安装到 /usr/local 中与安装版本和平台名称匹配的目录中。例如,安装程序文件 mysql-8.4.9-macos10.15-x86_64.dmg 将 MySQL 安装到 /usr/local/mysql-8.4.9-macos10.15-x86_64/ 中,并带有指向 /usr/local/mysql。下表显示了此 MySQL 安装目录的布局。When installing using the package installer, the files are installed into a directory within /usr/local matching the name of the installation version and platform. For example, the installer file mysql-8.4.9-macos10.15-x86_64.dmg installs MySQL into /usr/local/mysql-8.4.9-macos10.15-x86_64/ with a symlink to /usr/local/mysql. The following table shows the layout of this MySQL installation directory.

Note

macOS 安装过程不会创建或安装示例 my.cnf MySQL 配置文件。The macOS installation process does not create nor install a sample my.cnf MySQL configuration file.

表 2.8 macOS 上的 MySQL 安装布局Table 2.8 MySQL Installation Layout on macOS

目录Directory 目录内容Contents of Directory
binbin mysqld 服务器、客户端和实用程序mysqld server, client and utility programs
datadata 日志文件、数据库,其中 /usr/local/mysql/data/mysqld.local.err 是默认错误日志Log files, databases, where /usr/local/mysql/data/mysqld.local.err is the default error log
docsdocs 帮助文档,例如发行说明和构建信息Helper documents, like the Release Notes and build information
includeinclude 包含(标题)文件Include (header) files
liblib 库Libraries
manman Unix 手册页Unix manual pages
mysql-testmysql-test MySQL 测试套件(使用安装程序包 (DMG) 时,在安装过程中默认禁用“MySQL 测试”)MySQL test suite ('MySQL Test' is disabled by default during the installation process when using the installer package (DMG))
shareshare 其他支持文件,包括错误消息、 dictionary.txt,以及重写 SQLMiscellaneous support files, including error messages, dictionary.txt, and rewriter SQL
support-filessupport-files 支持脚本,例如 mysqld_multi.server、mysql.server 和 mysql-log-rotate。Support scripts, such as mysqld_multi.server, mysql.server, and mysql-log-rotate.
/tmp/mysql.sock/tmp/mysql.sock MySQL Unix 套接字的位置Location of the MySQL Unix socket