使用JDBC连接MySql时出现: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
在连接字符串后面加上?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
原文链接:https://www.cnblogs.com/EasonJim/p/6906713.html
为了可以随时找到做个记录,侵删
本文介绍了使用JDBC连接MySql时遇到的时区问题及解决方案。可以通过在连接字符串中添加?serverTimezone=UTC来解决时区不匹配的问题,同时还可以解决中文乱码问题。

443

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



