情景: 为了方便数据调试,所以我讲数据库拷贝了一份在自己的本地数据库中,然后将代码中的数据库配置成自己本地连接,然而,之前都能够正常启动,但是改成自己的本地数据库连接后,就启动失败了,一脸懵逼的找了老半天原因。
我代码中的数据库配置是这样的:
启动后,报的错是这个:
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时区的问题
在设定时区的时候,如果设定serverTimezone=UTC,会比中国时间早8个小时,如果在中国,可以选择Asia/Shanghai或者Asia/Hongkong
注意: 如果数据库url连接中,不设置时区,则很有可能报错哟。