I\'m using Python 3.6 (but I get the same error with Python 2.7) and mysql-connector-python in an Anaconda\'s environment to code a simple script to access my database hoste
This only seems to happen when the mysql-connector-python
library uses the C extensions instead of the pure python implementation.
Since version 8.0.11, the default changed and it now uses the C extensions if they're present.
https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html
One solution is to force the connector tu use the python implementation via that flag, just adding it to the connection url in your configuration:
url = 'mysql+mysqlconnector://user:password@mysql_server/database?use_pure=True'
I had the exact same problem, but since I was unable to use mlcr's solution (it was an AWS RDS database) my solution was different. I had to change mysql-connector-python versions from 8.x.x to 2.2.3. That resolved my issue entirely. Hope this helps someone.
This worked for me (Ubuntu 16.04 LTS). From terminal:
mysql_ssl_rsa_setup --datadir=/data/dir/
/etc/mysql/mysql.conf.d/mysqld.cnf
:ssl-ca=/data/dir/cacert.pem ssl-cert=/data/dir/server-cert.pem ssl-key=/data/dir/server-key.pem
sudo service mysql restart
I had the same issue and resolved it by adding use_pure=True
argument based a suggestion here:
import mysql.connector as sql
db_connection = sql.connect(host='****', database='****', user='****', password='****', use_pure=True)
Relevant packages on my mac: mysql-connector-python 8.0.16
and openssl 1.1.1b
installed (both anaconda).
I ran into the same issue on my mac, I was running mysql-connector-python version 8.0.16, I fixed the issue by downgrading to version 8.0.5