美文网首页
springboot mysql serverTimezone

springboot mysql serverTimezone

作者: 万事俱备就差一个程序员了 | 来源:发表于2022-05-08 08:41 被阅读0次

serverTimezone = GMT即可

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/XXX?useUnicode=true&characterEncoding=utf8&serverTimezone = GMT

1、概念: serverTimezone连接mysql数据库时指定了时差

2、时区示例:

//北京时间东八区

serverTimezone=GMT%2B8

//上海时间

serverTimezone=Asia/Shanghai

3、重要性

(1)时差会导致插入的date数据发生变化(自动更换时差)

(2)UTC是全球标准时间,北京地区早标准时间8小时

(3)注意使用useSSL=false

————————————————

版权声明:本文为CSDN博主「成长中的码农Mr.Yellow」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/qq_41595727/article/details/108556767

相关文章

网友评论

      本文标题:springboot mysql serverTimezone

      本文链接:https://www.haomeiwen.com/subject/lanfurtx.html