错误原因: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的8.0.13版本,所以配置数据库的url时候一定要把serverTimezone=UTC添加上。
附上MYSQL连接参数说明
# useUnicode 是否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,本参数值必须设置为true
# characterEncoding 当useUnicode设置为true时,指定字符编码。比如可设置为gb2312或gbk
# useSSL JDBC版本与MySQL版本不兼容,MySQL的版本更高一些,在连接语句后加上useSSL="true"
# serverTimezone 将时区设置为你当前系统时区
# rewriteBatchedStatements 如果不开启rewriteBatchedStatements=true,那么jdbc会把批量插入当做一行行的单条处理,也即没有达到批量插入的效果
# autoReconnect 当数据库连接异常中断时,是否自动重新连接?(true/false)
# maxReconnects autoReconnect设置为true时,重试连接的次数
# initialTimeout autoReconnect设置为true时,两次重连之间的时间间隔,单位:秒
# failOverReadOnly 自动重连成功后,连接是否设置为只读?(true/false)
# connectTimeout 和数据库服务器建立socket连接时的超时,单位:毫秒。 0表示永不超时,适用于JDK 1.4及更高版本
# socketTimeout socket操作(读写)超时,单位:毫秒。 0表示永不超时