import pymysql
db=pymysql.connect(host="localhost",
user="",# 用户名
password="*****", # 密码
db="", #链接数据库的名
port=3306 # 端口
)
# Create your views here.
cur=db.cursor()
sql="SELECT * FROM miulee limit 10"
try:
cur.execute(sql)
results=cur.fetchall()
except Exception as e:
raise e