Skip to content

Instantly share code, notes, and snippets.

@askcompany-kr
Created March 16, 2020 09:25
Show Gist options
  • Select an option

  • Save askcompany-kr/a86d8ae6b573973d0d810b08924ea93b to your computer and use it in GitHub Desktop.

Select an option

Save askcompany-kr/a86d8ae6b573973d0d810b08924ea93b to your computer and use it in GitHub Desktop.
host = '...'
user = '…'
name = '…'
password = '…'
import MySQLdb
db = MySQLdb.connect(host, user, password, name)
cursor = db.cursor()
try:
cursor.execute('SELECT VERSION()')
info = cursor.fetchone()[0]
print(repr(info))
finally:
cursor.close()
db.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment