<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- springboot在没有指定版本的情况下默认依赖的版本非常高,会出现
1、You must configure either the server or JDBC driver (via the serverTimezone conf)
2、The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.
这两种情况的错误是由于安装mysql的时候时区设置的不正确 mysql默认的是美国的时区,而我们中国大陆要比他们迟8小时,采用+8:00格式;
可用以下两种方法来解决:
1、降低MySQL驱动版本的方法;
2、在配置文件中的spring.datasource.url后面加上“?serverTimezone=UTC”来指定时区
-->
<!-- <version>5.1.28</version> -->
<scope>runtime</scope>
</dependency>
springboot整合mybatis连接数据库时报错
最新推荐文章于 2024-07-22 10:58:27 发布