Skip to content

Instantly share code, notes, and snippets.

@ShahriyarR
Created May 27, 2014 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShahriyarR/d2caeb70d5109adf6970 to your computer and use it in GitHub Desktop.
Save ShahriyarR/d2caeb70d5109adf6970 to your computer and use it in GitHub Desktop.
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