1. 版本引发的问题
(The server time zone value 'Ãùú±êüñ¼ä' is unrecognized or represents more than one time zone.)
<!--MySQL的JDBC驱动包-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version> 8.0.13</version>
</dependency>
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&characterEncoding=utf8&useSSL=false
username: root
password: xxxx
当mysql的JDBC驱动包版本是6(+)时,驱动名称是 com.mysql.cj.jdbc.Driver,并且必须指定serverTimezone,否则项目启动时会报serverTimezone乱码
当mysql的JDBC驱动包版本是6(-),驱动名称是com.mysql.jdbc.Driver,serverTimezone是非必需的指定