mysql 升级到v8.X版本后出现了 the server requested authentication method unknown to the client

错误示例;

 

解决办法

1、将加密方式改为旧的,在配置文件my.cnf中添加如下;

如何查询到mysql的配置文件请使用该命令

$ mysqld --help --verbose | less
...
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
...

  

依次查找 /etc/my.cnf  /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

找到以后在配置文件中添加:

 [mysqld]
 default_authentication_plugin=mysql_native_password

  

2. 修改用户的加密方式

mysql -uroot -p
use mysql
ALTER USER 'root'@'localhost'  IDENTIFIED WITH mysql_native_password  BY 'password';

  

原文地址:https://www.cnblogs.com/rianley/p/14439680.html