This pure Python MySQL client provides a DB-API to a MySQL database by talking directly to the server via the binary client/server protocol.
Example:
import pymysql
conn = pymysql.connect(host='127.0.0.1', unix_socket='/tmp/mysql.sock', user='root', passwd=None, db='mysql')
# conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd=None, db='mysql')
cur = conn.cursor()
cur.execute("SELECT Host,User FROM user")
# print cur.description
# r = cur.fetchall()
# print r
# ...or...
for r in cur:
print r
cur.close()
conn.close()
Commercial Use
Modify
Distribute
Sub-License
Private Use
Hold Liable
Include Copyright
Include License
These details are provided for information only. No information here is legal advice and should not be used as such.
30 Day SummaryJan 2 2025 — Feb 1 2025
|
12 Month SummaryFeb 1 2024 — Feb 1 2025
|