8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

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

2.8.6 配置 SSL 库支持2.8.6 Configuring SSL Library Support

需要 SSL 库来支持加密连接、随机数生成的熵等加密相关的操作。An SSL library is required for support of encrypted connections, entropy for random number generation, and other encryption-related operations.

如果您从源发行版编译 MySQL,CMake 会将发行版配置为默认使用已安装的 OpenSSL 库。If you compile MySQL from a source distribution, CMake configures the distribution to use the installed OpenSSL library by default.

要使用 OpenSSL 进行编译,请使用以下过程:To compile using OpenSSL, use this procedure:

  1. 确保您的系统上安装了 OpenSSL 1.0.1 或更高版本。如果安装的 OpenSSL 版本早于 1.0.1,CMake 会在 MySQL 配置时产生错误。如果需要获取 OpenSSL,请访问http://www.openssl.org。Ensure that OpenSSL 1.0.1 or newer is installed on your system. If the installed OpenSSL version is older than 1.0.1, CMake produces an error at MySQL configuration time. If it is necessary to obtain OpenSSL, visit http://www.openssl.org.

  2. WITH_SSL CMake 选项确定使用哪个 SSL 库来编译 MySQL(请参阅第 2.8.7 节“MySQL 源配置选项”)。默认值为 -DWITH_SSL=system,它使用 OpenSSL。要明确这一点,请指定该选项。例如:The WITH_SSL CMake option determines which SSL library to use for compiling MySQL (see Section 2.8.7, “MySQL Source-Configuration Options”). The default is -DWITH_SSL=system, which uses OpenSSL. To make this explicit, specify that option. For example:

    cmake . -DWITH_SSL=system
    

    该命令将发行版配置为使用已安装的 OpenSSL 库。或者,要显式指定 OpenSSL 安装的路径名,请使用以下语法。如果您安装了多个版本的 OpenSSL,这会很有用,可以防止 CMake 选择错误的版本:That command configures the distribution to use the installed OpenSSL library. Alternatively, to explicitly specify the path name to the OpenSSL installation, use the following syntax. This can be useful if you have multiple versions of OpenSSL installed, to prevent CMake from choosing the wrong one:

    cmake . -DWITH_SSL=path_name
    

    通过在 EL7 上使用 WITH_SSL=openssl11 或在 EL8 上使用 WITH_SSL=openssl3 支持替代 OpenSSL 系统包。身份验证插件(例如 LDAP 和 Kerberos)已被禁用,因为它们不支持 OpenSSL 的这些替代版本。Alternative OpenSSL system packages are supported by using WITH_SSL=openssl11 on EL7 or WITH_SSL=openssl3 on EL8. Authentication plugins, such as LDAP and Kerberos, are disabled since they do not support these alternative versions of OpenSSL.

  3. 编译并安装发行版。Compile and install the distribution.

要检查 mysqld 服务器是否支持加密连接,请检查 tls_version 系统变量:To check whether a mysqld server supports encrypted connections, examine the value of the tls_version system variable:

mysql> SHOW VARIABLES LIKE 'tls_version';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| tls_version   | TLSv1.2,TLSv1.3 |
+---------------+-----------------+

如果该值包含 TLS 版本,则服务器支持加密连接,否则不支持。If the value contains TLS versions then the server supports encrypted connections, otherwise it does not.

有关更多信息,请参阅部分 8.3.1,“配置 MySQL 以使用加密连接”。For additional information, see Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”.