使用mysql8,报错信息如下:

The server requested authentication method unknown to the client 

经查找是mysql换了加密方式caching_sha2_password

 这里修改用户加密方式为  mysql_native_password  可解决问题

1 首先查看mysql 默认加密方式

show variables like 'default_authentication_plugin';

The server requested authentication method unknown to the client

的确是这样的。

2 然后看用户的加密方式

select host,user,plugin from mysql.user;

The server requested authentication method unknown to the client

3. 修改某个用户的加密方式为 mysql_native_password  

ALTER USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'password';