I am trying to connect to Mysql server on localhost from my django application on Ubuntu 19.04. The database connection section in settings.py looks like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'app_datastore',
'HOST' : '127.0.0.1',
'USER': 'root',
'PASSWORD': 'xxxx',
'OPTIONS': {
'ssl': {
'ca': '/var/lib/mysql/ca.pem',
'cert': '/var/lib/mysql/client-cert.pem',
'key': '/var/lib/mysql/client-key.pem'
}
}
}
}
It gives the error :
django.db.utils.OperationalError: (2026, 'SSL connection error: SSL_CTX_set_tmp_dh failed')
I can however connect to my mysql from both terminal and Dbeaver. mysql server is up.
Stackoverflow threads which I have already tried and doesnt work :
django.db.utils.OperationalError: (2026, 'SSL connection error: SSL_CTX_set_tmp_dh failed')
SSL Connection Error while using MySQL Connector with Python
Python SQL connection error (2006, 'SSL connection error: SSL_CTX_set_tmp_dh failed')
Here are my pip list results :
Package Version
cffi 1.14.0
cryptography 2.8
Django 2.2.2
mysqlclient 1.4.6
Pillow 7.0.0
pip 20.0.2
pycparser 2.19
pyOpenSSL 19.0.0
pytz 2019.3
setuptools 45.2.0
six 1.14.0
sqlparse 0.3.0
wheel 0.34.2