错误信息:
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.

出错的原因:
MySQL server 的时区和本地时区不符合
解决方法:
在连接数据库的url后面加上serverTimezone=GMT%2B8
eg:
jdbc:mysql://localhost:3306/database?
变为:
jdbc:mysql://localhost:3306/database?serverTimezone=GMT%2B8

本文详细解释了当遇到MySQL数据库时区配置错误时的解决办法。主要原因是MySQL服务器的时区设置与本地时区不匹配,导致时间数据处理异常。解决方案是在数据库连接URL中明确指定时区参数,如serverTimezone=GMT+8,确保服务器和客户端时区一致,避免时间转换错误。
2万+

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



