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.

解决办法:
在连接字符串后面加上?serverTimezone=UTC
其中UTC是统一标准世界时间。
完整的连接字符串示例:jdbc:mysql://localhost:3306/test?serverTimezone=UTC
或者还有另一种选择:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8,这个是解决中文乱码输入问题,当然也可以和上面的一起结合:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

本文详细介绍了如何解决MySQL服务器时区配置不正确的问题,通过在连接字符串中添加特定参数来确保时间数据的准确处理。同时,提供了示例连接字符串,帮助用户避免因时区设置不当导致的数据错误。

590

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



