python链接mysql pymysql
时间:2021-07-01 10:21:17
帮助过:5人阅读
pymysql
conn = pymysql.connect(user=
‘user1‘, password=
‘123456‘, database=
‘gbt2019‘, charset=
‘utf8‘)
cursor =
conn.cursor()
query = (
‘select id, title from data_2019100501‘)
cursor.execute(query)
for (id, title)
in cursor:
print(id, title)
cursor.close()
conn.close()
python链接mysql pymysql
标签:set mysq print mysql password sql ase cursor base