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

这里是一个真诚的***青年技术交流QQ群:860334871***,不管你是大学生、社畜、想学习变成的其他人员,欢迎大家加入我们,一起成长,一起进步,真诚的欢迎你,不管是技术,还是人生,还是学习方法。有道无术,术亦可求,有术无道,止于术。


版权声明:本文为weixin_42103983原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。