一佳一

记录像1+1一样简洁的代码

导航

springboot2.0 mysql 5.0 和6.0配置

Posted on 2022-03-21 17:38  一佳一  阅读(460)  评论(0编辑  收藏  举报

一般报错 java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required 就是jdbc对应的mysql版本出错

 

5.0 需要制定版本 不用管最后子版本 

<!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.30</version>
        </dependency>

对应application.yml

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456
    url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8

 

 

6.0 

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

 

对应application.yml 要加个 cj