import pymysql conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='root', db='test_db',charset='utf8') cur = conn.cursor() cur.execute("select * from users") # print(cur.description) # print() for row in cur: print(row) cur.close() conn.close()