{"record":{"id":"0fa267e75dcc2120","repo":"apache/seatunnel","slug":"unexpected-error-while-connecting-to-mysql-and-loo-0fa267","errorCode":null,"errorMessage":"Unexpected error while connecting to MySQL and looking for binary logs: ","messagePattern":"Unexpected error while connecting to MySQL and looking for binary logs: ","errorType":"exception","errorClass":"DebeziumException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlConnection.java","lineNumber":403,"sourceCode":"    /**\n     * Determine the earliest binlog filename that is still available in the server.\n     *\n     * @return the name of the earliest binlog filename, or null if there are none.\n     */\n    public String earliestBinlogFilename() {\n        // Accumulate the available binlog filenames ...\n        List<String> logNames = new ArrayList<>();\n        try {\n            LOGGER.info(\"Checking all known binlogs from MySQL\");\n            query(\n                    \"SHOW BINARY LOGS\",\n                    rs -> {\n                        while (rs.next()) {\n                            logNames.add(rs.getString(1));\n                        }\n                    });\n        } catch (SQLException e) {\n            throw new DebeziumException(\n                    \"Unexpected error while connecting to MySQL and looking for binary logs: \", e);\n        }\n\n        if (logNames.isEmpty()) {\n            return null;\n        }\n        return logNames.get(0);\n    }\n\n    /**\n     * Determine whether the MySQL server has the binlog_row_image set to 'FULL'.\n     *\n     * @return {@code true} if the server's {@code binlog_row_image} is set to {@code FULL}, or\n     *     {@code false} otherwise\n     */\n    protected boolean isBinlogRowImageFull() {\n        try {\n            final String rowImage =","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlConnection.java#L385-L421","documentation":"earliestBinlogFilename executes SHOW BINARY LOGS to list available binlog files and wraps any SQLException into this DebeziumException. The connector needs the earliest binlog name to validate or reset the starting offset; the failure prevents that lookup.","triggerScenarios":"SQLException while running SHOW BINARY LOGS inside earliestBinlogFilename — connection error, or user lacking privileges to view binary logs.","commonSituations":"CDC user without REPLICATION CLIENT privilege cannot list binary logs; all binlogs purged leaving an empty list (returns null rather than throwing); transient connection drops at startup.","solutions":["Grant REPLICATION CLIENT (and REPLICATION SLAVE) to the CDC user","Verify the MySQL connection and credentials","Check binlog retention so logs are not purged before the connector reads them","Inspect the cause SQLException for the server-side error"],"exampleFix":"// before\nGRANT SELECT ON *.* TO 'cdc'@'%';\n// after\nGRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'cdc'@'%';","handlingStrategy":"validation","validationCode":"try (Statement s = conn.createStatement()) { ResultSet rs = s.executeQuery(\"SHOW BINARY LOGS\"); if (!rs.next()) { throw new IllegalStateException(\"no binary logs available\"); } }","typeGuard":null,"tryCatchPattern":"catch (DebeziumException e) { logger.error(\"SHOW BINARY LOGS failed\", e.getCause()); /* check grants/connection, then retry */ }","preventionTips":["Grant REPLICATION CLIENT so SHOW BINARY LOGS is allowed","Ensure binlog retention exceeds max connector downtime","Test binlog listing with the exact CDC user","Alert on binlog purge events"],"tags":["mysql","binlog","jdbc","cdc"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}