新的 MySQL 驱动程序导致 java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37348572/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 19:13:42  来源:igfitidea点击:

New MySQL driver causes java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

javamysqlssljdbc

提问by Dims

If change MySQL JDBC driver from 5.1.38to 6.0.2I get the following exception

如果将 MySQL JDBC 驱动程序从 更改5.1.386.0.2我得到以下异常

java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

This exception was happened in normal JDBC initilization.

此异常发生在正常的 JDBC 初始化中。

Probably, this can be related with SSL, since I get the following messages also

可能,这可能与 SSL 相关,因为我也收到以下消息

Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

不建议在没有服务器身份验证的情况下建立 SSL 连接。根据 MySQL 5.5.45+、5.6.26+ 和 5.7.6+ 要求,如果未设置显式选项,则必须默认建立 SSL 连接。为了符合不使用 SSL 的现有应用程序,verifyServerCertificate 属性设置为“false”。您需要通过设置 useSSL=false 来显式禁用 SSL,或者设置 useSSL=true 并为服务器证书验证提供信任库。

which were absent in previous version.

在以前的版本中没有。

回答by Slava Imeshev

This sounds like a regression. Was there a particular reason to switch to 6.0.2? If not, I'd revert back to 5.1.38 and give 6.x a shot after three months to let folks at MySQL to stabilize the driver.

这听起来像是一种回归。切换到 6.0.2 是否有特殊原因?如果没有,我会恢复到 5.1.38 并在三个月后尝试 6.xa,让 MySQL 的人稳定驱动程序。

回答by Merwais Muafaq

I had the same issue and I resolved by changing the parent tag version from 2.1.1.RELEASE to 2.0.0.RELEASE

我遇到了同样的问题,我通过将父标签版本从 2.1.1.RELEASE 更改为 2.0.0.RELEASE 来解决

from

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

to

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

回答by Aruna Kumara

I resolve this problem by removing mysql version in pom.

我通过删除 pom.xml 中的 mysql 版本解决了这个问题。

<dependency>
     <groupId>mysql</groupId>
     <artifactId>mysql-connector-java</artifactId>       
</dependency>   

回答by vvs

It seems new versions of mysql connector(from 6 on)are not compatible with old version of the DBMS mysql(below 5.6). So in order to solve your problem, if you make an update of mysql connector, try to do the same with the DBMS. Actually I had the same issu with mysql connector 8.0.13and the DBMS msql 5.1....I solved it by moving the DBMS to 5.6.17

似乎新版本的mysql 连接器(从 6 开始)与旧版本的DBMS mysql(低于 5.6)不兼容。因此,为了解决您的问题,如果您更新mysql 连接器,请尝试对DBMS执行相同操作。实际上,我对mysql 连接器 8.0.13DBMS msql 5.1有相同的问题......我通过将DBMS 移至 5.6.17解决了这个问题