PyMysql下载地址:
https://pypi.python.org/pypi/PyMySQL#downloads
PyMySQL-0.7.11.tar.gz
下载解压后,进入PyMySql-0.7.11目录,执行python setup.py install安装
import pymysql
conn = pymysql.connect(host='localhost', port=3306,user='root',passwd='a123456',db='test',charset='UTF8')
cur = conn.cursor()
cur.execute("select version()")
for i in cur:
print(i)
cur.close()
conn.close()