jsp mysql connection solution does not appear to support authentication protocol

Error message

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

 

wrong reason

Mysql8 in versions prior to encryption rule is mysql_native_password, and after Mysql8, encryption rules are caching_sha2_password

Mysql shelf package I use is in the jsp mysql-connector-java-5.0.8-bin.jar, MySql8 above error will be if used

 

Solution

Replacement encryption algorithm

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)

 

Guess you like

Origin www.cnblogs.com/luocodes/p/11876098.html