flask-migrate数据库迁移出现sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2059, <NULL>)

操作

python manage.py db migrate -m 'init_tables'
在执行数据库迁移命令时,出现以下错:

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2059, <NULL>) (Background on this error at: http://sqlalche.me/e/e3q8)

bug原因

原因:mysql 8.0以上,用户密码采用的加密方式发生了改变。从 mysql_native_password 变成了 caching_sha2_password。
flask-mysqldb驱动没有做对应的修改,因此出现了mysql就报了2059的错。

debug

方法一:flask-mysqldb适应了caching_sha2_password的驱动版本。
方法二:修改mysql的加密方式为原来的mysql_native_password参考(https://blog.51cto.com/496292/2137232)。

原文地址:https://www.cnblogs.com/custoyth/p/13870554.html