import time
from sys import path
path.append(r‘C:\Users\Administrator\ceshi1111\Lib\site-packages\pymysql‘)
import pymysql
from pymysql import *
db = pymysql.connect(‘192.168.137.9‘,"root","123123","mysql") #:调用pymysql.connect方法 并输入数据库的信息
cursor = db.cursor() #:调用db中的cursor类
cursor.execute("insert into test1 values(‘1‘);") #:sql语句
db.commit() #:提交事务
date = cursor.fetchall()
db.close() #:关闭连接