2018-08-01mysql-python

2018-08-01  本文已影响0人  加勒比海带_4bbc

coding=utf-8

import pymysql

连接数据库

db = pymysql.connect(host='61.164.208.174',user='root_read',passwd='12345,abcde',db='db_rcld_zj_statistics',port=39306,charset='utf8')
cursor = db.cursor()
cursor.execute('SELECT * FROM t_acq_data_20160830 where SHIP_ID =30698')

得到所有数据

res = cursor.fetchall()
for i in res:
print(i)

得到一条数据

res = cursor.fetchone()

print(res)

上一篇下一篇

猜你喜欢

热点阅读