【Python】 读写MySQL
db_info = {'user': 'root',
'password': '123456',
'host': 'localhost',
'port': 3306,
'database': 'test'
}
'mysql+pymysql://%(user)s:%(password)s@%(host)s:%(port)d/%(database)s?charset=utf8' % db_info, encoding='utf-8'
'mysql+pymysql://root:123456@localhost:3306/test', encoding='utf-8'
用pymysql,则必须用cursor
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='123456', db='test') # engine = create_engine('mysql+pymysql://root:123456@localhost:3306/test')
完整版参考:https://www.cnblogs.com/fuqia/p/8996033.html
-------------------------------
********厚德达理,励志勤工********
-------------------------------