The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one...

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.

错误信息翻译
java.sql.SQLException:
服务器时区值’???ú±ê×??±??'是未被认可的,或表示多个时区。

如果你想要使用时区支持,你必须配置服务器或JDBC驱动(通过服务器Timezone配置属性)来使用更为特定的时区值。

错误处理
配置中增加serverTimezone=GMT

spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=GMT

在url中添加:
1)如果是xml的文件
url=“jdbc:mysql://localhost:3306/yonghedb?characterEncoding=utf-8&serverTimezone=GMT”

2)非xml文件
url=“jdbc:mysql://localhost:3306/yonghedb?characterEncoding=utf-8&serverTimezone=GMT”

note:由于是xml配置,所以使用&表示&,如果url配置文件不为xml,可以直接使用&。

发布了27 篇原创文章 · 获赞 0 · 访问量 850

猜你喜欢

转载自blog.csdn.net/xiaobao1352/article/details/104404964