django訪問mysql數(shù)據(jù)庫報(bào)錯(cuò):
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
查看當(dāng)前加密方式:
use mysql;
select user,plugin from user where user='root';
修改加密方式:
alter user 'root'@'localhost' identified with mysql_native_password by 'password';
生效:
flush privileges;