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

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

pom.xml中的依赖



org.mybatis.spring.boot
mybatis-spring-boot-starter
2.1.3



mysql
mysql-connector-java
8.0.22

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

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

posted @ 2021-04-01 19:20  DbWong_0918  阅读(861)  评论(0)    收藏  举报