diff --git a/e2e_test/source/cdc/mysql_cdc.sql b/e2e_test/source/cdc/mysql_cdc.sql index dd1a1f70628a0..0ac47fc7fbd1b 100644 --- a/e2e_test/source/cdc/mysql_cdc.sql +++ b/e2e_test/source/cdc/mysql_cdc.sql @@ -49,13 +49,14 @@ VALUES (1,1,'no'), (3,3,'no'), (4,4,'no'); --- user rwcdc used for shared mysql source -CREATE USER 'rwcdc'@'%' IDENTIFIED BY '123456'; -GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'rwcdc'@'%'; - CREATE USER 'dbz'@'%' IDENTIFIED BY '123456'; GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'dbz'@'%'; +CREATE USER 'rwcdc'@'%' IDENTIFIED BY '123456'; +GRANT SELECT, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'rwcdc'@'%'; + +FLUSH PRIVILEGES; + CREATE TABLE tt3 (v1 int primary key, v2 timestamp); INSERT INTO tt3 VALUES (1, '2020-07-30 10:08:22'); INSERT INTO tt3 VALUES (2, '2020-07-31 10:09:22'); diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java index b01dd76b001bf..2c6cee3dfba73 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java @@ -181,16 +181,10 @@ private void validateTableSchema() throws SQLException { } private void validatePrivileges() throws SQLException { - final String[] dedicatedSourcePrivileges = { - "SELECT", "RELOAD", "SHOW DATABASES", "REPLICATION SLAVE", "REPLICATION CLIENT", + String[] privilegesRequired = { + "SELECT", "RELOAD", "REPLICATION SLAVE", "REPLICATION CLIENT", }; - final String[] sharedSourcePrivileges = { - "SELECT", "REPLICATION SLAVE", "REPLICATION CLIENT", - }; - - String[] privilegesRequired = - isMultiTableShared ? sharedSourcePrivileges : dedicatedSourcePrivileges; var hashSet = new HashSet<>(List.of(privilegesRequired)); try (var stmt = jdbcConnection.createStatement()) { var res = stmt.executeQuery(ValidatorUtils.getSql("mysql.grants"));