JDBC Connection MySQL 8 times wrong "mysqlnontransientconnectionexception:public Key retrieval is not allowed"

Source: Internet
Author: User
Tags jboss mysql command line maven central

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"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.