Caused by: org.apache.flink.table.api.ValidationException: The MySQL server has a timezone offset (28800 seconds ahead of UTC) which does not match the configured timezone America/New_York. Specify the right server-time-zone to avoid inconsistencies for time-related fields.
flink cdc 由mysql往flink table表里面同步数据时报上面错,是由于flink table创建时数据库服务器中的会话时区设置的不对。
配置上'server-time-zone' = 'Asia/Shanghai' 即可
CREATE TABLE products (
id INT,
name STRING,
description STRING,
PRIMARY KEY (id) NOT ENFORCED
) WITH (
'server-time-zone' = 'Asia/Shanghai',
'connector' = 'mysql-cdc',
'hostname' = '192.168.56.130',
'port' = '3306',
'username' = 'root',
'password' = 'root',
'database-name' = 'cdc',
'table-name' = 'products'
);
MySQL CDC 连接器 — CDC Connectors for Apache Flink® documentation