authentication method unknown to the client [caching_sha2_password]
今天在看php mysql连接池的时候搭建了一个临时服务器来使用,安装的是mysql8.0
在安装好后用代码连接出现如上错误,
解决方法:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限
参考连接:https://blog.csdn.net/u010026255/article/details/80062153