I am trying to implement TLS in mysql and everything works with in connecting to it except a python code in the raspberry pi.

the code looks like this:

import mysql.connector
import mysql.connector.constants import ClientFlag

database = mysql.connector.connect(
    host = "test.test",
    user = "user",
    password = "password",
    database = "base",
    client_flags = [ClientFlag.SSL],
    tls_version = ["TLSv1.2"],
    ssl_ca = "/home/pi/Desktop/ca-cert.pem",
    ssl_cert = "/home/pi/Desktop/client-cert.pem",
    ssl_key = "/home/pi/Desktop/client-key.pem",
cursor = database.cursor()

The error that is popping up is: (KeyError: "tls_versions") then in traceback it is also (attributeError: unsuported argument 'tls_versions') Have also tried without tls_version keyword and then the error: (switch_to_ssl self.sock.do_handshake()

Have anyone had the same problem? this code works on my 2 other computer but not on the pi. I believe the problem is with openssl because the pi has 1.1.1n


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.