在用JDBC连MySQL又报时区异常,MySQL的默认时区是SYSTEM,在获取JDBC连接时加上serverTimezone = UTC即可解决这一问题

1
2
3
4
5
6
7

```xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>

Driver:

1
com.mysql.cj.jdbc.Driver