import pymysql conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='123456', db='mydb') cur = conn.cursor() cur.execute("SELECT * FROM users2") print(cur.description) print() for row in cur: print(row) cur.close() conn.close()
import pymysql conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='123456', db='mydb') cur = conn.cursor() cur.execute("SELECT * FROM users2") print(cur.description) print() for row in cur: print(row) cur.close() conn.close()