apache/seatunnel · error · DebeziumException

Error reading MySQL variables:

Error message

Error reading MySQL variables: 

What it means

MySqlConnection.querySystemVariables runs a SQL query (e.g. SHOW VARIABLES) over a JDBC connection and wraps any SQLException into a DebeziumException with this message. It means the connector could not read MySQL server system variables needed to build its connection context. The original SQLException is preserved as the cause.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlConnection.java:172

        final Map<String, String> variables = new HashMap<>();
        try {
            query(
                    statement,
                    rs -> {
                        while (rs.next()) {
                            String varName = rs.getString(1);
                            String value = rs.getString(2);
                            if (varName != null && value != null) {
                                variables.put(varName, value);
                                LOGGER.debug(
                                        "\t{} = {}",
                                        Strings.pad(varName, 45, ' '),
                                        Strings.pad(value, 45, ' '));
                            }
                        }
                    });
        } catch (SQLException e) {
            throw new DebeziumException("Error reading MySQL variables: " + e.getMessage(), e);
        }

        return variables;
    }

    protected String setStatementFor(Map<String, String> variables) {
        StringBuilder sb = new StringBuilder("SET ");
        boolean first = true;
        List<String> varNames = new ArrayList<>(variables.keySet());
        Collections.sort(varNames);
        for (String varName : varNames) {
            if (first) {
                first = false;
            } else {
                sb.append(", ");
            }
            sb.append(varName).append("=");
            String value = variables.get(varName);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify MySQL host, port, username and password in the connector configuration and test with a mysql client
  2. Confirm the MySQL user can connect and run SHOW VARIABLES (grant as needed)
  3. Check network reachability, firewall rules, and TLS settings between the connector and MySQL
  4. Inspect the wrapped SQLException (cause) for the root cause and fix accordingly

Example fix

// before: generic user/password
MySQLConnection config = MySqlConnection.create(
    MySqlConnectionConfiguration.builder()
        .withHostname("wrong-host") ... );
// after: verified reachable endpoint
MySQLConnection config = MySqlConnection.create(
    MySqlConnectionConfiguration.builder()
        .withHostname("mysql.internal")
        .withPort(3306)
        .withUser("debezium")
        .withPassword("secret") ... );
Defensive patterns

Strategy: try-catch

Validate before calling

try (Connection c = DriverManager.getConnection(url, user, pass)) { try (Statement s = c.createStatement(); ResultSet rs = s.executeQuery("SHOW VARIABLES")) { rs.next(); } }

Try / catch

try { mysqlConnection.sessionVariables(); } catch (DebeziumException e) { logger.error("Failed to read MySQL variables", e.getCause()); /* fail fast or retry with backoff */ }

Prevention

When it happens

Trigger: Any SQLException thrown while executing the variables query inside querySystemVariables, invoked via readMySqlCharsetSystemVariables, readMySqlSystemVariables, or sessionVariables — e.g. connection dropped mid-query, bad credentials, unknown database, or server refused the statement.

Common situations: Wrong hostname/port or firewall blocking the DB during connector startup; MySQL user lacking privileges to execute SHOW VARIABLES; server restarted or connection timed out; SSL/TLS mismatch between driver and server.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e17a15e08e7e4550. Report an issue: GitHub.