django.db.utils.OperationalError: (2026, 'SSL connection error: SSL_CTX_set_tmp_dh failed')


I’m new to python and django. When I run python runserver I get this error:

django.db.utils.OperationalError: (2026, 'SSL connection error: SSL_CTX_set_tmp_dh failed')'
mysql Server version: 8.0.13 MySQL Community Server - GPL.

I can’t find this error on the web.

Asked By: P.Cheng



I got the answer:’

‘shell> bin/mysql_ssl_rsa_setup’

Answered By: P.Cheng

I had this issue too when installing from Anaconda, but I could work around it using the “use_pure=True” mysql.connector.connect() parameter.

Answered By: Hyperdrive

I ran into the same error when I tried to connect to MySQL to Python (in Anaconda).

This feed is particularly helpful for various case scenarios leading to the same error. For me, installing openSSL version 1.0.2r in Anaconda, itself, fixed the issue:

$ conda install openssl=1.0.2r

Answered By: girlthatCANeven

Open The file under the same directory as
add the following code:

import pymysql

Answered By: Ali
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.