gpt4 book ai didi

mysql - 如何通过连接字符串告诉mysql时区?

转载 作者:行者123 更新时间:2023-11-29 06:46:57 25 4
gpt4 key购买 nike

由于某种原因,我在尝试启动我的 java 应用程序时收到此错误。

java.sql.SQLException: The server time zone value 'AEDT' 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.

我希望能够更改连接字符串上的时区。到目前为止我尝试过这个:

javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/returnit?useLegacyDatetimeCode=false&serverTimezone=UTC"

还有这个:

javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/returnit?useLegacyDatetimeCode=false&serverTimezone=Australia/Sydney"

但由于某种原因 mysql 没有获取时区并且仍然提示 AEDT?

Mysql连接器版本是6.0.6我在 MacOS 中运行的系统Mysql版本是

问题:知道如何通过连接字符串设置 serverTimezone 吗?

非常感谢

最佳答案

这是指定 serverTimezone 的连接字符串示例:

"jdbc:mysql://localhost:3306/returnit?useSSL=false&useUnicode=true&serverTimezone=UTC"

关于mysql - 如何通过连接字符串告诉mysql时区?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48916808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com