If you use pymysql to connect to MySQL, an error 1366 will be reported
engine=create_engine('mysql+pymysql://root:1234@localhost/b',#Specify the database engine to connect to, e.g. MySQL, Oracle, etc. encoding='utf-8', echo=False)
Error reporting:
E:\Anacoda\lib\site-packages\pymysql\cursors.py:170: Warning: (1366, "Incorrect string value: '\\xD6\\xD0\\xB9\\xFA\\xB1\\xEA...' for column 'VARIABLE_VALUE' at row 497") result = self._query(query)
Solution
Download MySQL connector Python from the official MySQL website: https://dev.mysql.com/downloads/connector/python/
After downloading and installing, change pymysql in the original connection code to mysqlconnector
engine=create_engine('mysql+mysqlconnector://root:1234@localhost/b', encoding='utf-8', echo=False)
Similar Posts:
- [Solved] Python import module error: importerror: no module named mysql.connector
- [Solved] Python pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query…
- [Solved] MYSQL8 Error: ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- [Solved] Error when connecting to MySQL when creating Django project
- mysql ERROR 1044 (42000): Access denied for user ‘
- How to Solve MYSQL Error: pymysql.err.InterfaceError: (0, ”)
- For the problem of establishing SSL connection in mysql, set usessl = false to explicitly disable SSL, or set usessl = true
- Error in connecting to MySQL via Navicat on MAC
- [Solved] MYSQL Error: this authentication plugin is not supported
- [Solved] SQLyog Connect MYSQL Error: 2058 plugin caching_sha2_password could not be loaded