设置系统及myslq时区信息,避免程序时间不配置

星期五, 2022-07-29 | Author: Lee | JAVA-and-J2EE, linux | 536 views

起因程序用了 date 做查询判断,因系统及mysql不一致,导致插入到数据库的时间和系统时间有差距

造成查询失误,重复插入的问题,故需要调成一致即可.

timedatectl set-timezone "America/New_York"
 
##在[mysqld]区域中加上
vim /etc/my.cnf 
default-time_zone = '-4:00'
###或者##
default-time_zone = 'America/New_York'
 
#/etc/init.d/mysqld restart ##重启mysql使新时区生效

Tags: ,

文章作者: Lee

本文地址: https://www.pomelolee.com/2315.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Links

Meta