X Tutup
The Wayback Machine - https://web.archive.org/web/20211015132422/https://github.com/PyMySQL/PyMySQL/blob/main/example.py
Skip to content
Permalink
main
Switch branches/tags
Go to file
@methane
Latest commit 0b2dd7e Jan 3, 2021 History
5 contributors

Users who have contributed to this file

@methane @petehunt @lecram @jakesylvestre @davidstory
17 lines (11 sloc) 280 Bytes
#!/usr/bin/env python
import pymysql
conn = pymysql.connect(host="localhost", port=3306, user="root", passwd="", db="mysql")
cur = conn.cursor()
cur.execute("SELECT Host,User FROM user")
print(cur.description)
print()
for row in cur:
print(row)
cur.close()
conn.close()
X Tutup