First, the question
Due to power outage overhaul, restart the server today, then start JBoss error "Mysqlnontransientconnectionexception:public Key retrieval is not allowed", JBoss could not obtain a JDBC connection to the data source.
Ii. process of Settlement
Baidu, first said the old version of the JDBC driver bug, so from the MAVEN Central Library to download the latest Mysql-connector-8.0.11.jar, replace the modle instructions to modify JBoss, the configuration file in the Driver-class changed to ' Com.mysql.cj.jdbc.Driver ', but the error remains.
Continue Baidu, said to be required to modify the Default_authentication_plugin settings, so modify My.ini, increase [mysqld] Default_authentication_plugin=mysql_native_ Password, restart MySQL 8, error still.
Continue Baidu, said is still need to modify the user's password encryption method, so in the MySQL command line execution: ALTER user ' myuser ' @ ' localhost ' identified with Mysql_native_password by ' MyPassword '; this time, although the error is still incorrect, it turns out to be "invalidconnectionattributeexception:the-server-zone value < garbled > ' is Unrecognized or represents more than one time zone. ......”。
Continue Baidu, said to be in the JDBC connection string need to specify time zone, so modify the Connection-url in the JBoss configuration file, in the end add Servertimezone=asia/shanghai, restart JBoss, finally clearance.
Iii. Summary
- Replace the MySQL JDBC driver, but actually from 5.1.37 has been updated this bug, not necessarily to use 8.0.11;
- Modify My.ini (Linux is my.cnf), add [mysqld] Default_authentication_plugin=mysql_native_password;
- Performed at the MySQL command line: ALTER USER ' myuser ' @ ' localhost ' identified with Mysql_native_password by ' mypassword ';
- Specify the time zone in the JDBC connection string.
Iv. questions
Although the problem is solved, there are still several questions:
- Why is everything OK before the power outage is restarted?
- In order to avoid SSL, Connection-url in the configuration file added Usessl=false, is it related?
JDBC Connection MySQL 8 times wrong "mysqlnontransientconnectionexception:public Key retrieval is not allowed"