forked from PyMySQL/PyMySQL
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
Latest commit
24 lines (14 loc) · 438 Bytes
/
Copy pathexample.py
File metadata and controls
24 lines (14 loc) · 438 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
importpymysql
#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='', db='mysql')
cur=conn.cursor()
cur.execute("SELECT Host,User FROM user")
# print cur.description
# r = cur.fetchall()
# print r
# ...or...
forrincur.fetchall():
printr
cur.close()
conn.close()