需要 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:
确保您的系统上安装了 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.
WITH_SSLCMake 选项确定使用哪个 SSL 库来编译 MySQL(请参阅第 2.8.7 节“MySQL 源配置选项”)。默认值为-DWITH_SSL=system,它使用 OpenSSL。要明确这一点,请指定该选项。例如:TheWITH_SSLCMake 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 usingWITH_SSL=openssl11on EL7 orWITH_SSL=openssl3on EL8. Authentication plugins, such as LDAP and Kerberos, are disabled since they do not support these alternative versions of OpenSSL.编译并安装发行版。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”.