【SpringBoot】java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/gdkyxy2013/article/details/90244904

SpringBoot项目中调用了MySQL数据库的数据,结果在查询数据的时候报了如下的错误:

java.sql.SQLException: 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.

【报错原因】

这个错误是时区错误,需要在配置文件中添加上我们所在的时区。

【解决办法】

在application.properties中修改连接数据库的链接如下:

spring.datasource.url=jdbc:mysql://localhost:3306/xzw?serverTimezone=GMT%2B8

再次测试,发现该时区错误已解决~

猜你喜欢

转载自blog.csdn.net/gdkyxy2013/article/details/90244904
今日推荐