之前在升级网站的时候,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
原文地址:https://www.cnblogs.com/boirn/p/11745179.html
时间: 2024-10-10 12:35:19