170418-Centos7修改系统时区

Centos7修改系统时区

前言

突然发现Linux本地时间和当前时间不符,正好差八个小时,导致上面的mysql在进行数据处理的时候,时间不符。所以修改一下centos7的时区为Asia/Shanghai

查询服务器时间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@laosanxin ~]# timedatectl
Local time: 四 2017-04-18 21:27:29 CST
Universal time: 四 2017-04-18 13:27:29 UTC
RTC time: 四 2017-04-18 21:27:29
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
This mode can not be fully supported. It will create various problems
with time zone changes and daylight saving time adjustments. The RTC
time is never updated, it relies on external facilities to maintain it.
If at all possible, use RTC in UTC by calling
'timedatectl set-local-rtc 0'.

第二步;修改时区为Asia/Shanghai

1
[root@laosanxin ~]# timedatectl  set-timezone Asia/Shanghai

第三步:查看修改后的结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@laosanxin ~]# timedatectl
Local time: 四 2017-04-18 21:30:53 CST
Universal time: 四 2017-04-18 13:30:53 UTC
RTC time: 四 2017-04-18 21:30:52
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
This mode can not be fully supported. It will create various problems
with time zone changes and daylight saving time adjustments. The RTC
time is never updated, it relies on external facilities to maintain it.
If at all possible, use RTC in UTC by calling
'timedatectl set-local-rtc 0'.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×