flink-cdc
flink-cdc copied to clipboard
无法指定链接参数 AllowPublicKeyRetrieval=True
在使用 mysql 8.0 的时候报下面的,需要指定链接参数 AllowPublicKeyRetrieval=True,但是没有找到配置的地方
Caused by: java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:230) at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:871) at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:866) at io.debezium.jdbc.JdbcConnection.connect(JdbcConnection.java:412) at io.debezium.connector.mysql.MySqlJdbcContext.querySystemVariables(MySqlJdbcContext.java:328) ... 11 more
我也遇到了同样的问题
我也遇到了同样的问题
如果只是自己开发,可以先用cdc的账号先登录一下
我也遇到了同样的问题
如果只是自己开发,可以先用cdc的账号先登录一下
没懂,是这样?还是不行呢。
--FlinkSQL CREATE TABLE products ( id INT, name STRING, description STRING ) WITH ( 'connector' = 'mysql-cdc', 'hostname' = 'localhost', 'port' = '3306', 'username' = 'mysqluser', 'password' = 'mysqlpw', 'database-name' = 'mydb', 'table-name' = 'products' );
有人解决了这个问题吗
指定参数
'debezium.database.allowPublicKeyRetrieval' = 'true'
Debezium & MySQL v8 : Public Key Retrieval Is Not Allowed
我的密码策略时mysql_native_password,我的原因找到了,是因为用户名和密码错了(没有这个用户),提示也是 Public Key Retrieval Is Not Allowed
You can also modify the JDBC parameters by adding useSSL = False
and allowPublicKeyRetrieval= True
in case don't plan to change any configuration on the server:
Configure for DataStream
as below:
Properties jdbcProperties = new Properties
jdbcProperties.setProperty("useSSL", "false")
jdbcProperties.setProperty("allowPublicKeyRetrieval", "true")
MySqlSource.<String>builder()
...
.jdbcProperties(jdbcProperties)
.build();
Configure for Flink SQL
as below:
Flink SQL> CREATE TABLE table (
...
) WITH (
'connector' = 'mysql-cdc',
...
'jdbc.properties.useSSL' = 'false',
'jdbc.properties.allowPublicKeyRetrieval' = 'true');
Properties jdbcProperties = new Properties jdbcProperties.setProperty("useSSL", "false") jdbcProperties.setProperty("allowPublicKeyRetrieval", "true") 添加这两个参数之后不报错了,但是我监听两个mysql表,只能监听到一张表的binlog,而且只能是第一全量,之后无法动态获取到这张表的binlog日志。另外一张表从flink日志看到监听sql,不知道为什么有过滤条件。
我的表环境配置 'debezium.database.allowPublicKeyRetrieval' = 'true',\n" 就可以了 奇怪的用root 用户就没有此问题
Closing this issue because it was created before version 2.3.0 (2022-11-10). Please try the latest version of Flink CDC to see if the issue has been resolved. If the issue is still valid, kindly report it on Apache Jira under project Flink
with component tag Flink CDC
. Thank you!