最近,我将本地机器操作系统从Ubuntu18.04升级到20.04,我正在CentOS (AWS)上运行MySQL。无论何时我试图连接到MySQL服务器,它都会抛出SSL连接错误。
$ mysql -u yamcha -h database.yourproject.com -p --port 3309
ERROR 2026 (HY000): SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol但是如果我通过了--ssl-mode=disabled选项,我就可以远程连接。
$ mysql -u yamcha -h database.yourproject.com -p --port 3309 --ssl-mode=disabled
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22158946
Server version: 5.7.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> 查询:
--ssl-mode=disabled --ssl-mode=disabled选项,目前我已经定义了它,如下所示,但我仍然会收到相同的错误。DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'yamcha',
'USER': 'yamcha',
'PASSWORD': 'xxxxxxxxxxxxxxx',
'HOST': 'database.yourproject.com',
'PORT': '3309',
'OPTIONS': {'ssl': False},
}发布于 2020-05-21 12:07:43
Ubuntu 20提高了安全级别。我唯一能连接的方法就是允许tls 1。
编辑此文件:
/usr/lib/ssl/openssl.cnf放在文件的开头:
openssl_conf = default_conf在这份文件的末尾:
[ default_conf ]
ssl_conf = ssl_sect
[ssl_sect]
system_default = ssl_default_sect
[ssl_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT:@SECLEVEL=1它对我有很大帮助:https://askubuntu.com/questions/1233186/ubuntu-20-04-how-to-set-lower-ssl-security-level
发布于 2021-01-27 09:37:55
对于任何谷歌用户,您可以在mysql cmd:--ssl-mode=DISABLED中使用此标志。即:
mysql -uuser -p'myPassw0rd!' -hmysql.company.com --ssl-mode=DISABLED发布于 2020-11-23 15:22:16
将其添加到MySQL5.7服务器配置文件中,然后重新启动mysql服务
[mysqld]
tls_version=TLSv1.2现在您应该能够使用TLS1.2连接到它,这是Ubuntu20.04中的缺省值。
为了完整起见,在Ubuntu20.04中,my.cnf和mysql.cnf实际上是同一个文件。所以编辑这两种方法都是可行的。
$ readlink -f /etc/mysql/my.cnf
/etc/mysql/mysql.cnfhttps://stackoverflow.com/questions/61649764
复制相似问题