python操作Mysql数据库

文档介绍(待补充)

 

import pymysql

#链接数据库(梦测数据库)
conn = pymysql.connect(host="140.143.203.**",port=3306,user="root",passwd="*est123456.",db="zhaoy",charset="utf8")

#创建游标
cur = conn.cursor()

#执行SQL
cur.execute("select * from adv_info_type ")

data = cur.fetchone()
data = cur.fetchmany()
data = cur.fetchall()

print(data)

cur.close()
conn.commit()
conn.close()

 

posted @ 2018-07-25 14:31  赵丫丫  阅读(139)  评论(0编辑  收藏  举报