好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

spring boot中连接数据库报错500(mybatis)

spring boot中连接数据库报错500(mybatis)

pom.xml中的依赖

     <!-- 集成mybatis-->
    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>2.1.3</version>
    </dependency>

    <!-- 集成mysql连接 -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.22</version>
    </dependency>
 

在文件中的数据库连接的情况

 server.port=8880
test.hello=hello2
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=test
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.mapper-locations=classpath:/mapper/**/*.xml
 

然后就一直报错500,提示未连接成功jdbc

后面发现只要将url改成

 spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
 

就可以正常显示了,这说明默认是多么重要啊xdm

spring boot中连接数据库报错500(mybatis)

标签:username   mysql连接   enc   mysq   host   version   pen   ima   source   

查看更多关于spring boot中连接数据库报错500(mybatis)的详细内容...

  阅读:27次

上一篇: mysql 8.0 安装

下一篇:MongoDB 角色权限