python连接mysql数据库时出现1366错误

解决办法:

第一步:
命令行下安装模块:mysql-connector-python
pip install mysql-connector-python

第二步:
将连接引擎的:mysql+pymysql
engine = create_engine(“mysql+pymysql//user:password@host/{data_base}”,encoding=‘utf-8’)
修改为:mysql+mysqlconnector
engine = create_engine(“mysql+mysqlconnector//user:password@host/{data_base}”,encoding=‘utf-8’)

你可能感兴趣的:(小问题,python,mysql,python,mysql)