1、下载安装包,进行安装
https://www.python.org/downloads/windows/
2、打开cmd,输入python,查看python查看版本
3、安装PyMySQL
在cmd命令行中输入以下命令,进行安装
pip install PyMySQL
4、示例
#!/usr/bin/env python
-- coding: utf-8 --
import pymysql.cursors
import uuid
import datetime
连接配置信息
config = {
‘host’: ‘127.0.0.1’,
‘port’: 3306,
‘user’: ‘jiankunking’,
‘password’: ‘12345678’,
‘db’: ‘test’,
‘charset’: ‘utf8mb4’,
‘cursorclass’: pymysql.cursors.DictCursor,
}
创建连接
connection = pymysql.connect(**config)
counter = 1
n =