mysql connector python fails with "3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON."

Viewed 1093

I'm trying to connect to mysql DB using mysql-connector-python 8.0.28 and receiving SSL error. Python version is 3.7.5. MySQL version is 8.025.

We can't disabled --require_secure_transport=ON as customer wants security. We tried ssl_disabled = True option from mysql connector documentation.

try:
            self.conn = mysql.connector.connect(host=host,user=user,password=key, database='xxxx', port=3306, ssl_disabled=True)
            self.info = self.conn.get_server_info()
            #print(self.info)
            self.cursor = self.conn.cursor(dictionary=True)
            return self
        except Error as e:
            logger.error(str(e))

Does anyone has workaround for this issue?

1 Answers

Reason: This error occurs when the user is trying to add a SSL-supported monitor (i.e --require_secure_transport option enabled) as a non-SSL monitor in Applications Manager.

Solution: To overcome this issue follow the steps given below: Execute the following query in the corresponding mysql shell script:

    ALTER USER '<user>'@'<host/Ip-address>' REQUIRE <tls_option>; [ tls_option: { SSL | X509 | CIPHER 'cipher' | ISSUER 'issuer' | SUBJECT 'subject' } ]

Add client certificates along with its root certificates in AppManagerHome/working/cert/apm.keytore.

Add the monitor by enabling 'SSL' option in Add New Monitor page. If the monitor has already been added, update the 'SSL' option in Edit Monitor page.

Related