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

后端 未结 6 698
感动是毒
感动是毒 2021-02-06 04:51

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

java.sql.SQLNonTransientConnectionException: CLIENT_PLUG         


        
相关标签:
6条回答
  • 2021-02-06 05:39

    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.

    0 讨论(0)
  • 2021-02-06 05:40

    It may be due to mysql version is too old so you need to do 3 changes in that case: in application.properties do first 2 changes:

    1. spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

    2. spring.datasource.driver-class-name=com.mysql.jdbc.Driver

    3. Do changes in pom.xml file in dependency of mysql-connector-java replace scope tag to the version tag and in version write your mysql version like 5.1

    0 讨论(0)
  • 2021-02-06 05:42

    I resolve this problem by removing mysql version in pom.

    <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>       
    </dependency>   
    
    0 讨论(0)
  • 2021-02-06 05:43

    I had the same issue and I resolved by changing the parent tag version from 2.1.1.RELEASE to 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>
    
    0 讨论(0)
  • 2021-02-06 05:51

    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.13 and the DBMS msql 5.1.... I solved it by moving the DBMS to 5.6.17

    0 讨论(0)
  • 2021-02-06 05:51
        Use Maven depandency 
    ###pom.xml  
               <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.37</version>
                </dependency>
    
    ##application.properties
    
    server.port=9092
    jwt.secret=javainuse
    spring.datasource.url=jdbc:mysql://localhost:3306/hospital
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name= com.mysql.jdbc.Driver
    spring.datasource.platform=mysql
    #spring.jpa.hibernate.ddl-auto=create-drop
    
    spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
    spring.jpa.hibernate.ddl-auto= update
    
    #spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
    
    0 讨论(0)
提交回复
热议问题