MySQL数据库时区异常,java.sql.SQLException The server time zone value ‘й׼ʱ‘ is unrecognized or represents

原因:

        数据库安装时默认为英语,0:00时区

        Windows系统中,XP的时区是GMT,而Win7的时区是UTC。

        mysql返回的时间会比实际时间要早8小时。

解决方案:

配置idbc连接参数,UTC,世界均衡时间;GMT,格林尼治时间

在url连接字符串后面加上?serverTimezone=UTC

jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC

猜你喜欢

转载自blog.csdn.net/qq_42680327/article/details/129625588
今日推荐