2019-06-03 django.db.utils.Opera
2019-06-03 本文已影响0人
昨天今天下雨天1
错误:
django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3\r\n")
原因:
经过一番查询,调试,最终发现了问题所在。主要就是mysql8.0的问题。
目前最新的mysql8.0对用户密码的加密方式为caching_sha2_password, django暂时还不支持这种新增的加密方式。只需要将用户加密方式改为老的加密方式即可。
解决方案:
以下命令是在cmd窗口下完成的。
1.登录mysql,连接用户为root。
mysql -u root -p
2.执行命令查看加密方式
use mysql;
select user,plugin from user where user='root';
3.执行命令修改加密方式
alter user 'root'@'localhost' identified with mysql_native_password by 'yourpassword'
4.属性权限使配置生效
flush privileges
重设mysql8.0的加密方式后,再次启动django服务器就没有任何问题了。