Skip to content

Instantly share code, notes, and snippets.

@rbk
Created March 23, 2018 13:14
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 rbk/109aacf125eee63bdcc14999973141c3 to your computer and use it in GitHub Desktop.
Save rbk/109aacf125eee63bdcc14999973141c3 to your computer and use it in GitHub Desktop.
Connect to MySQL via PyMysql
import pymysql
connection = pymysql.connect(host='<ip-or-domain>',
user='<dbuser>',
password='<dbpass>',
db='<dbname>',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor,
autocommit=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment