查看时区
tzselect
GMT-5
Washington
America/Washington
# 设置时区 New_York有夏时令替换,Atikokan和EST无夏时令替换
timedatectl set-timezone America/New_York
timedatectl set-timezone America/Atikokan
ln -sf /usr/share/zoneinfo/EST /etc/localtime
#查询时区
timedatectl | grep "Time zone"
timedatectl set-timezone Asia/Singapore
timedatectl set-timezone Asia/Shanghai
Asia/Shanghai
//mysql .ini
default-time-zone = '-5:00'
/----------------强制修改本地时间---------------------
timedatectl
开启关闭ntp(这样就不会自动同步时间了)
timedatectl set-ntp true/false
timedatectl set-ntp false
date -s '2021-09-01 20:57:00'
date -s '2021-10-18 22:01:30'
mv /etc/localtime /etc/localtime5.bak
ls /usr/share/zoneinfo/
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ln -s /usr/share/zoneinfo/UTC-05 /etc/localtime
ln -s /usr/share/zoneinfo/EST5EDT /etc/localtime
ln -s /usr/share/zoneinfo/EST-05 /etc/localtime
EST
GMT
UTC
GST+4
CST-13
//--------------------直接这里设置----------------------------------
vi etc/profile
export TZ='GST+5'
export TZ='GST+4'
方法2:
让/etc/profile文件修改后立即生效 ,可以使用如下命令:
# source /etc/profile
%2d
serverTimezone=GMT%2D5
serverTimezone=GMT%2B8
-Duser.timezone=GMT-05
set global time_zone='-5:00';
&useTimezone=true&serverTimezone=GMT%2D5
上面是我到处找的,但是最终西五区时间,我用的是下面
/----------------强制修改本地时间---------------------
timedatectl
开启关闭ntp(这样就不会自动同步时间了)
timedatectl set-ntp true/false
timedatectl set-ntp false
date -s '2021-09-01 20:57:00'
date -s '2021-10-18 22:01:30'