Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import mysql.connector
from mysql.connector.constants import ClientFlag
from mysql.connector import Error
config = {
'user': 'ssluser',
'password': 'Pass@123#',
'host': '192.168.1.77',
'database':'world',
'client_flags': [ClientFlag.SSL],
'ssl_ca': '/home/sh/mysql-ssl/ca-cert.pem',
'ssl_cert': '/home/sh/mysql-ssl/client-cert.pem',
'ssl_key': '/home/sh/mysql-ssl/client-key.pem',
}
try:
cnx = mysql.connector.connect(**config)
except Error as err:
print err
cur = cnx.cursor(buffered=True)
query = "select * from city"
b = True
while b:
cur.execute(query)
for a in cur:
print a
#cur.execute("SHOW STATUS LIKE 'Ssl_cipher'")
cur.close()
cnx.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.