错误提示

com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client

 

错误原因

Mysql8 之前的版本中加密规则是mysql_native_password,而在Mysql8之后,加密规则是caching_sha2_password

笔者在jsp中使用的Mysql的架包是mysql-connector-java-5.0.8-bin.jar,如果使用的MySql8以上就会报错

 

解决办法

更换加密算法

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.17    |
+-----------+
1 row in set (0.01 sec)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';
Query OK, 0 rows affected (0.02 sec)

mysql> FLUSH PRIVILEGES; 
Query OK, 0 rows affected (0.01 sec)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
  • 2021-07-25
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2021-04-10
相关资源
相似解决方案