1. Error reporting details
fail to open MySQL connection: [CDC:ErrMySQLConnectionError]Error 1298: Unknown or incorrect time zone: 'Asia/Shanghai'
2. Troubleshooting
# Login tidb and check the time zone
show variables like '%time_zone%';
+------------------+---------------+
| Variable_name | Value |
+------------------+---------------+
| system_time_zone | Asia/Shanghai |
| time_zone | SYSTEM |
+------------------+---------------+
# login mysql and check the time zone
show variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | SYSTEM |
+------------------+--------+
It can be found that the time zone of the upstream tidb is North America/USA, while the time zone of the downstream MySQL is CST
3. Solution
Method 1: load the time zone
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p
Method 2: write sink to upstream and downstream time zones
cdc cli changefeed create --sink-uri="mysql://user:[email protected]_ip:mysql_port/?time-zone=CST" --pd=http://pd_ip:pd_port
Read More:
- Idea connect mysql error Server returns invalid timezone. Go to’Advanced’ tab and set’serverTimezone’ property
- [Solved] MySQL connection error: communications link failure
- Solve ERROR 1231 (42000): Variable’time_zone’ can’t
- MySQL 8.0 error 1114 (HY000): the table’sbtest1’is full (Fixed)
- Mybatis Error: The server time zone value ‘����1532a0’ is unrecognized
- [Solved] EOS7.6 Error: Init DB failed [Specified key was too long; max key length is 767 bytes…
- Sqlyog connection MySQL error: 2003 [How to Solve]
- [Solved] Django configures MySQL Error: NameError: name ”_MySQL ‘is not defined
- MySQL server has gone away Error [How to Solve]
- [Solved] MySQL5.6.44 [Err] 1067 – Invalid default value for create_date settlement programme
- MySQL character set error resolution: err=Error 3988: Conversion from collation utf8mb4_unicode_ci into utf8_general_ci impo
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- [Solved] Mysql Build Error: [ERROR] Slave I/O for channel ‘‘: error connecting to master
- [How to Fix] Database can’t open file (errno:24)
- Problems in connecting mysql8.0 in IDEA [How to Solve]
- MySQL Install Error: MySQL error 1042: Unable to connect to any of the specified MySQL hosts
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- MYSQL Error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: Yes)
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- Mysql8.02/ubuntu 20 ERROR 1449 (HY000) [How to Solve]