如题所示,当我们使用springboot版本高于2.1.4.RELEASE时,数据库驱动,默认变成了com.mysql.cj.jdbc.Driver,而非原来的com.mysql.jdbc.Driver,这个也直接导致了后面连接数据库会发生报错信息:
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.
解决办法就是给数据库连接url设置一个serverTimezone的参数,值可以是GMT-8,也可以是Asia/Shanghai,因为GMT-8需要转义一下连字符"-",所以配置属性为serverTimezone=GMT%2B8,如果是Asia/Shanghai就无须做转换了。
当SpringBoot版本高于2.1.4.RELEASE时,数据库驱动默认更新为com.mysql.cj.jdbc.Driver,可能引发数据库连接错误。本文介绍如何通过配置serverTimezone参数解决时区问题。
5477

被折叠的 条评论
为什么被折叠?



