
报了这个错说明以下几个问题:
1.你是用的mysql连接器mysql-connector-java版本在6以上
2.你的数据库time_zone没有值,通过show VARIABLES like '%time_zone%'可以查看到

3.在mysql连接属性里面没有配置serverTimezone
解决方法,在连接属性上加上serverTimezone属性即可
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://xxxxxx?useUnicode=true&charactorEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai现在mysql官网推荐使用新版的com.mysql.cj.jdbc.Driver,com.mysql.jdbc.Driver已不再维护!
更多mysql连接属性请参考mysql官网:https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html