springboot+mybatis框架连接,新版本8.0mysql的配置

1         <dependency>
2             <groupId>org.springframework.boot</groupId>
3             <artifactId>spring-boot-starter-jdbc</artifactId>
4         </dependency>
5         <dependency>
6             <groupId>mysql</groupId>
7             <artifactId>mysql-connector-java</artifactId>
8             <version>8.0.11</version>
9         </dependency>            

2、application.properties

spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://xxx.xxx.x.xxx:3306/aiwmcx?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&serverTimezone=UTC

驱动Driver推荐用:com.mysql.cj.jdbc.Driver,不用com.mysql.jdbc.Driver
注意:新版8.0的mysql驱动的url必须设置时区,即:serverTimezone=UTC,否则会报如下错误:

springboot+mybatis框架连接,新版本8.0mysql的配置

 

参考资料:https://blog.csdn.net/qq_20788055/article/details/80380099

 

springboot+mybatis框架连接,新版本8.0mysql的配置

上一篇:MYSQL基础知识


下一篇:VueRouter-404错误配置