本人操作系统为win10,python安装版本为2.7,数据库使用的MySQL5.0
在使用python连接MySQL数据库是遇到的资源库问题、在GitHub上找到了解决方案https://github.com/PyMySQL/PyMySQL/tree/master/pymysql,在此记录一下。
下图的问题信息,看似是下载成功了,却告诉我说缺少C++资源库。
正确的方式是:pip install PyMySQL
连接数据库的代码:
import pymysql.cursors
# 打开数据库连接
conn = pymysql.connect("localhost", "root", "****", "python", charset='utf8' )
cur = conn.cursor()
cur.execute("insert into table_name(字段名字) values(后面要跟的值)")
conn.commit() #提交请求