简体   繁体   English

Python MySQLdb 无法连接服务器,SSL 问题

[英]Python MySQLdb cannot connect to server, SSL Issue

_mysql_exceptions.OperationalError: (2026, 'SSL connection error: SSL_CTX_set_tmp_dh failed')

is thrown at me when I try to run my script which connects to my SQL server.当我尝试运行连接到我的 SQL 服务器的脚本时,我被抛出。 I installed MySQLdb via conda.我通过 conda 安装了 MySQLdb。 I've read that this may be an openssl issue, but I'm having trouble downgrading that as well.我读过这可能是 openssl 问题,但我也无法降级。

based on This answer .基于这个答案

I got the answer:' https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html '我得到了答案:' https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html

'shell> bin/mysql_ssl_rsa_setup' '外壳> bin/mysql_ssl_rsa_setup'

If you want to deploy the server with automatic support for secure connections, use the mysql_ssl_rsa_setup utility to create default SSL and RSA files如果要部署自动支持安全连接的服务器,请使用 mysql_ssl_rsa_setup 实用程序创建默认 SSL 和 RSA 文件

More information here 更多信息在这里

I was able to fix this my using mysql.connector instead of importing MySQLdb in my python scripts我能够使用mysql.connector解决这个问题,而不是在我的 python 脚本中导入MySQLdb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM