'caching_sha2_password' cannot be loaded

django访问mysql数据库报错:

django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/Cellar/mysql-connector-c/6.1.11/lib/plugin/caching_sha2_password.so, 2): image not found")

mysql8.0用户密码加密方式为caching_sha2_password,django暂不支持,需要修改下mysql的加密方式:

登录mysql:

mysql -u root -p

查看当前加密方式:

use mysql;
select user,plugin from user where user='root';

修改加密方式:

alter user 'root'@'localhost' identified with mysql_native_password by 'password';

生效:

flush privileges;
    原文作者:倪大头
    原文地址: https://www.jianshu.com/p/939eb5157e83
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞