python调用pymysql模块操作网络后台数据库mysql简易实例(节点精灵后台数据库)

from pprint import pprint

import pymysql as sql

conn = sql.connect(database='db_dev_3101', host='8.140.162.237', port=3307, user='16620122910',
                      password='********')
sql = "SELECT * FROM user WHERE True"#sql语句生成工具
cursor = conn.cursor()
cursor.execute(sql)
r=cursor.fetchall()
pprint(r)
cursor.close()
conn.close()

你可能感兴趣的:(数据库,python,mysql)