使用JDBC连接MySql时出现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
原文:https://blog.csdn.net/shenjiaxingy/article/details/78850634
原因:是因为 mysql返回的时间总是有问题,比实际时间要早8小时
解决方案: 在连接字符串后面加上?serverTimezone=UTC即可解决问题,如果需要使用gmt+8时区,需要写成GMT%2B8,否则可能报解析为空的错误
其中UTC是统一标准世界时间。
完整的连接字符串示例:jdbc:mysql://localhost:3306/test?serverTimezone=UTC