The server time zone value ‘?й???’ is unrecognized or represents more than one time zone. You must c

链接MySql数据库是报错

报错信息如下: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.

在写SpringBoot链接MyBitis时,运用了Durid的数据库连接池,在连接数据库的时候突然报错,搜了一下,具体的解决办法就是:
在jdbc连接的url后面加上serverTimezone=UTC或GMT即可,如果需要指定使用gmt+8时区,需要写成GMT%2B8,不然可能会报错误,解析为空。
例子如下:

spring.datasource.url=jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC

你可能感兴趣的:(错误集锦)