标签:username mysql连接 enc mysq host version pen ima source
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
原文地址:https://www.cnblogs.com/jokingremarks/p/14607754.html