mysql - MySQL ERROR 2026 - SSL 连接错误 - Ubuntu 20.04
问题描述
我最近将本地机器操作系统从 Ubuntu 18.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
在我的 Django 应用程序中传递此选项,目前我已将其定义如下所示,但我仍然遇到相同的错误。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'yamcha',
'USER': 'yamcha',
'PASSWORD': 'xxxxxxxxxxxxxxx',
'HOST': 'database.yourproject.com',
'PORT': '3309',
'OPTIONS': {'ssl': False},
}
解决方案
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
推荐阅读
- google-cloud-platform - 使用 python 和 Google Cloud Datacatalog 批量标记 Bigquery 列
- javascript - setTimeOut 在 for loop Javascript React 内部不起作用
- c# - Azure WebService 找不到我的程序集之一,但它基于 Azure 控制台存在
- python - 机器学习功能专栏
- python - 从views.py Django编辑列并将数据发送到数据库
- firebase-authentication - 使用 Firebase 联合身份验证对私有路由做出反应?
- angular - 在 Angular 中创建团队选项卡应用程序
- .net - 在自定义 Chrome 窗口的中心定位标题
- python - 如何使用 Signature 或 User ID 获取用户信息?
- arrays - 如何创建日期计数器?我用reduce函数试过了