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;