Timezone Issues

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 时区问题

| username: 等一分钟

The TiDB version is 5.3
Time zone variables:
mysql> show variables like ‘%zone%’;
±-----------------±--------+
| Variable_name | Value |
±-----------------±--------+
| system_time_zone | Etc/UTC |
| time_zone | +8:00 |
±-----------------±--------+

Question: The timestamp type data synchronized from MySQL is 8 hours less. Do I need to modify the system_time_zone variable value of TiDB or TiKV in tiup?

| username: ShawnYan | Original post link

This is the system time zone, first check the OS settings.

| username: 等一分钟 | Original post link

The system time zones for TiDB, PD, and TiKV are all CST.

| username: 等一分钟 | Original post link

Directly inserting timestamp data in TiDB is normal, but the timestamp data synchronized from MySQL will be 8 hours less.

| username: ShawnYan | Original post link

What tool did you use for synchronization? Did the synchronization process convert the timestamps?

| username: 等一分钟 | Original post link

Synchronized by DM

| username: 等一分钟 | Original post link

No conversion was done.

| username: yilong | Original post link

  1. What are the current TZ UTC equivalents? Refer to the documentation
    时区支持 | PingCAP 文档中心
  2. Time zone handling method
    日期和时间类型 | PingCAP 文档中心
  3. Is there a timezone in the DM configuration file?
    DM 任务完整配置文件介绍 | PingCAP 文档中心
    #timezone: “Asia/Shanghai” # Specifies the time zone used by the SQL Session during the data migration task. DM uses the global time zone configuration of the target database for data migration by default and automatically ensures the correctness of synchronized data. Using a custom time zone can still ensure the correctness of the entire process, but generally does not need to be manually specified.
| username: alfred | Original post link

The time zone parameters are consistent with MySQL, right? One is the database time zone, and the other is the system time zone.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.