hibernate 操作mysql mysql保存时间比系统时间少8小时 解决办法

xiaoxiao2021-02-28  109

排除mysql时区以及系统时区差别的情况下

hibernate 少8小时的jdbc url

jdbc:mysql://127.0.0.1:3306/popularfeelings?serverTimezone=GMT&characterEncoding=utf-8

解决办法

jdbc:mysql://127.0.0.1:3306/popularfeelings?serverTimezone=GMT+8&characterEncoding=utf-8

1. 将jdbc 连接的url中 serverTimezone=GMT 改为  GMT+8   其中 "+" 为 "+" 的转义

2.或者 将 serverTimezone=GMT 改为   Hongkong

转载请注明原文地址: https://www.6miu.com/read-42239.html

最新回复(0)