解决方案:mysql8以上版本时区问题: The server time zone value乱码XXXX异常

异常:

Caused by: java.sql.SQLException: 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.

解决方法:

链接URL后拼接参数serverTimezone=GMT
如: 

jdbc:mysql: //localhost:3306/db_spring?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT

或者

jdbc:mysql://localhost:3306/db_spring?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
posted @ 2021-07-04 20:45  白刃天使  阅读(466)  评论(0编辑  收藏  举报