Django2.2连接MySQL报错Authentication plugin 'caching_sha2_password' cannot be loaded

Posted boirn

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Django2.2连接MySQL报错Authentication plugin 'caching_sha2_password' cannot be loaded相关的知识,希望对你有一定的参考价值。

之前在升级网站的时候,runserver遇到了Authentication plugin ‘caching_sha2_password‘ cannot be loaded的报错。百度过后知道是因为mysql8采用了caching_sha2_password的加密方式,需要改回旧的mysql_native_password,在此附上修改方法:

mysql -u root -p password

>ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘password‘ PASSWORD EXPIRE NEVER;   #修改加密规则 

>ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘password‘;   #更新一下用户

>FLUSH PRIVILEGES;  #刷新权限

然后切记要及时重置密码,不然旧密码会失效,退出后就进不去了!!!(被坑过的??‍♂???,重置密码搞了半天)

>ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘12345678‘;

以上是关于Django2.2连接MySQL报错Authentication plugin 'caching_sha2_password' cannot be loaded的主要内容,如果未能解决你的问题,请参考以下文章

django2.2

Django2.2

Django2.2

django2.2/mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

Django2.2连接mysql数据库出现django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is requ

Django2.2 报错信息无法正常在页面显示