mysql 安装了最新版本8.0.20后创建用户并授权后,授权的用户连接数据库提示:
The server requested authentication method unknown to the client
这是由于php的mysqld拓展不支持caching_sha2_password加密方式:
只需要改一下登陆账号的认证方式即可:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
如果想要后面默认就是用这种方式,需要修改配置文件:
vim /etc/my.cnf
default_authentication_plugin=mysql_native_password