8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.9.5 自动启动和停止 MySQL2.9.5 Starting and Stopping MySQL Automatically

本节讨论启动和停止 MySQL 服务器的方法。This section discusses methods for starting and stopping the MySQL server.

通常,您启动 mysqld 服务器采用以下方式之一:Generally, you start the mysqld server in one of these ways:

systemd、mysqld_safe 和 mysql.server 脚本、Solaris SMF 和 macOS 启动项(或 MySQL 首选项窗格)可用于手动启动服务器,或在系统启动时自动启动服务器。 systemd、mysql.server,启动项也可用于停止服务器。systemd, the mysqld_safe and mysql.server scripts, Solaris SMF, and the macOS Startup Item (or MySQL Preference Pane) can be used to start the server manually, or automatically at system startup time. systemd, mysql.server, and the Startup Item also can be used to stop the server.

下表显示了服务器和启动脚本从选项文件中读取的选项组。The following table shows which option groups the server and startup scripts read from option files.

表 2.16 MySQL 启动脚本和支持的服务器选项组Table 2.16 MySQL Startup Scripts and Supported Server Option Groups

脚本Script 选项组Option Groups
mysqldmysqld [mysqld], [server], [mysqld-major_version][mysqld], [server], [mysqld-major_version]
mysqld_safemysqld_safe [mysqld]、[server]、[mysqld_safe][mysqld], [server], [mysqld_safe]
mysql.servermysql.server [mysqld]、[mysql.server]、[server][mysqld], [mysql.server], [server]

[mysqld-major_version] 表示具有[mysqld-8.3] 和 [mysqld-8.4] 等名称由版本 8.3.x、8.4.x 等的服务器读取。此功能可用于指定只能由给定版本系列中的服务器读取的选项。[mysqld-major_version] means that groups with names like [mysqld-8.3] and [mysqld-8.4] are read by servers having versions 8.3.x, 8.4.x, and so forth. This feature can be used to specify options that can be read only by servers within a given release series.

为了向后兼容,mysql.server 还会读取 [mysql_server] 组和 mysqld_safe 还会读取 [safe_mysqld] 组。要保持最新状态,您应该更新选项文件以使用 [mysql.server] 和 [mysqld_safe] 组。For backward compatibility, mysql.server also reads the [mysql_server] group and mysqld_safe also reads the [safe_mysqld] group. To be current, you should update your option files to use the [mysql.server] and [mysqld_safe] groups instead.

有关 MySQL 配置文件及其结构和内容的更多信息,请参阅第 6.2.2.2 节“使用选项”文件”。For more information on MySQL configuration files and their structure and contents, see Section 6.2.2.2, “Using Option Files”.