python 3.7 连接 mysql 8.0.15, 使用sqlalchemy来连接,报错如下
NotSupportedError: (mysql.connector.errors.NotSupportedError) Authentication plugin 'caching_sha2_password' is not supported
(Background on this error at: http://sqlalche.me/e/tw8g)
engine = create_engine('mysql+mysqlconnector://root:123456@127.0.0.1:3306/FOF?charset=utf8')
查了一些原因,试着改了密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
FLUSH PRIVILEGES;
mysql.ini文件下
default_authentication_plugin=mysql_native_password
也都正常,仍解决不了
基本上已经解决了,是因为数据库连接方式问题,我是用的mysql+mysqlconnector,最初用的MySQL-connector驱动,后来切换到mysql-connector-python驱动,问题就没了。