前言
今天把数据库版本从5.7升级到8.0后,启动springboot项目时报如下错误
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.
这样的问题,怎么解决,下面提供几种解决方案
解决方案
首页,把驱动版本进行升级,如下
把com.mysql.jdbc.Driver 换成 com.mysql.cj.jdbc.Driver
- 方案一,直接通过数据库命令修改(不推荐使用,数据库服务重启就没了)
通过客户端连接到数据库后,执行如下命令
- 方案二,修改连接配置文件
在yml文件增加serverTimezone=Asia/Shang