---
title: Troubleshoot MySQL ingestion issues
description: Fix common MySQL ingestion errors in Lakeflow Connect, such as connection failures, binary log issues, and tables that aren't ingested.
canonical_url: https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-troubleshoot
---

# Troubleshoot MySQL ingestion issues

> [!NOTE]
>
> This page contains references to the term *slave*, a term that Databricks doesn't use. When the term is removed from the third-party software, we'll remove it from this page.

For general troubleshooting guidance that applies to all managed ingestion pipelines, see [Troubleshoot managed ingestion pipelines](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/troubleshoot.md).

## Connector-specific troubleshooting

The troubleshooting steps in this section are specific to the MySQL connector.

### <a id="connection-issues" />Connection issues

#### **Test Connection** button fails

**Problem**: The **Test Connection** button fails in the UI, even though credentials are correct.

**Cause**: This is a known limitation for MySQL users with `sha256_password` or `caching_sha2_password` authentication plugins.

**Solution**: You can safely ignore this error and proceed with creating the connection. To confirm that your credentials work, run the following in the MySQL command-line client or another MySQL client tool:

```bash
mysql -h your-mysql-host -u lakeflow_connect_user -p
```

If the error message says `current plugin: mysql_native_password`, don't ignore it, because change data capture fails for that user. See [Change the authentication plugin of an existing user](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-privileges.md#change-plugin). Otherwise, if you can connect with the MySQL client, the connection works for ingestion despite the **Test Connection** failure.

#### Authorization failed for user after the snapshot completes

**Problem**: After the initial snapshot completes, change data capture fails with the `INGESTION_GATEWAY_SOURCE_CONNECTION_FAILURE` error class, even if **Test Connection** succeeds or you continued past its failure. The error message includes the following:

```output
Authorization failed for user: <user>. Please ensure the user exists with correct credentials and that either the 'sha256_password' or 'caching_sha2_password' authentication plugin is enabled.
```

The gateway driver log shows `Failed on connect: Authentication plugin 'mysql_native_password' cannot be loaded`.

**Possible causes and solutions**:

1. **The replication user uses `mysql_native_password`**: The connector doesn't support this plugin. Change the user to a supported plugin. See [Change the authentication plugin of an existing user](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-privileges.md#change-plugin).

2. **The connection goes through a proxy**: The connector doesn't support Amazon RDS Proxy or other connection-pooling proxies. Connect directly to the database instance or, for Aurora, the cluster writer endpoint. See [Network connectivity](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-limits.md#proxy).

#### Can't connect to MySQL server

**Problem**: Connection fails with errors like "Can't connect to MySQL server" or "Connection refused".

**Possible causes and solutions**:

1. **Network connectivity**:
   * Verify firewall rules allow traffic from Databricks IP ranges on port 3306.
   * Check security groups (AWS), NSGs (Azure), or firewall rules (GCP).
   * Verify VPC peering or network connectivity is properly configured.

2. **MySQL not listening on expected interface**:
   * Check the MySQL `bind-address` setting.
   * Ensure MySQL is listening on `0.0.0.0` or the specific IP address you're connecting to.

3. **Wrong host or port**:
   * Verify the hostname or IP address is correct.
   * Confirm the port (default 3306) is correct.

#### Access denied for user

**Problem**: Connection fails with "Access denied for user 'lakeflow\_connect\_user'@'host'".

**Possible causes and solutions**:

1. **Wrong password**: Verify the password is correct

2. **User not created or wrong host**:

   ```sql
   -- Check if user exists
   SELECT User, Host FROM mysql.user WHERE User = 'lakeflow_connect_user';

   -- User might need to be created for specific host or '%'
   CREATE USER 'lakeflow_connect_user'@'%' IDENTIFIED BY 'password';
   ```

3. **Missing privileges**:
   ```sql
   -- Grant required privileges
   GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'lakeflow_connect_user'@'%';
   GRANT SELECT ON your_database.* TO 'lakeflow_connect_user'@'%';
   FLUSH PRIVILEGES;
   ```

### <a id="binlog-issues" />Binary log issues

#### Binary logging not enabled

**Problem**: Pipeline fails with error indicating binary logging is not enabled. The same `INGESTION_GATEWAY_CDC_NOT_ENABLED` error class is reported when MySQL responds with `Binary log is not open`. In that case the affected tables are skipped.

**Cause**: Binary logging is turned off on the source.

**Solution**: Enable binary logging on your MySQL server:

* **RDS/Aurora**: Configure the parameter group and restart.
* **Azure MySQL**: Configure server parameters and restart.
* **GCP Cloud SQL**: Configure database flags and restart.
* **EC2**: Edit `my.cnf` and add `log-bin=mysql-bin`, then restart MySQL.

Verify with:

```sql
SHOW VARIABLES LIKE 'log_bin';
-- Should return ON
```

After binary logging is enabled, perform a full refresh of the skipped tables. See [Fully refresh target tables](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/full-refresh.md).

#### Wrong binlog format

**Problem**: Pipeline fails because binlog format is not `ROW`.

**Solution**: Set binlog format to `ROW`:

* **RDS/Aurora**: Set `binlog_format=ROW` in the parameter group.
* **Azure MySQL**: Set `binlog_format=ROW` in server parameters.
* **GCP Cloud SQL**: Set `binlog_format=ROW` in database flags.
* **EC2**: Add `binlog_format=ROW` to `my.cnf`.

Restart MySQL and verify:

```sql
SHOW VARIABLES LIKE 'binlog_format';
-- Should return ROW
```

#### Binlog purged before processing

**Problem**: Pipeline fails with error about missing binlog files.

**Cause**: Binary logs were purged before the connector could process them.

**Solution**:

1. Increase binlog retention:

   ```sql
   -- RDS/Aurora:
   -- Minimum: one day (24 hours), recommended: seven days (168 hours)
   CALL mysql.rds_set_configuration('binlog retention hours', 168);

   -- EC2 (MySQL 8.0):
   -- Minimum: one day (86400 seconds), recommended: seven days (604800 seconds)
   SET GLOBAL binlog_expire_logs_seconds = 604800;

   -- EC2 (MySQL 5.7):
   -- Minimum: one day, recommended: seven days
   SET GLOBAL expire_logs_days = 7;
   ```

2. Perform a full refresh of affected tables:
   * See [Fully refresh target tables](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/full-refresh.md)

3. For gateway-based pipelines, ensure the ingestion gateway runs continuously.

**Prevention**: Configure adequate binlog retention (minimum one day, seven days recommended). Setting a lower value might cause binlogs to be cleaned up before the connector processes them.

#### Binlog position unreadable

**Problem**: The pipeline update fails with the `INGESTION_GATEWAY_MYSQL_BINLOG_POSITION_UNREADABLE` error class. The error message names the binlog file and position, and includes the error that MySQL reported (MySQL error 1236), such as `I/O error reading log event` or `binlog truncated in the middle of event`.

**Cause**: The binlog file exists, but MySQL can't read the event at the position the gateway parsed.

**Solution**: Perform a full refresh of all tables in the pipeline. This takes a new snapshot and resumes CDC from a current binlog position. See [Fully refresh target tables](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/full-refresh.md).

To investigate the cause, connect to the source MySQL server and check the following. Do this before the binlog file is purged, because the file might be deleted once your retention period passes.

1. Check that the binlog file named in the error still exists:

   ```sql
   SHOW BINARY LOGS;
   ```

2. Check whether MySQL can read events from the position named in the error. Replace the file name and position with the values from the error message:

   ```sql
   SHOW BINLOG EVENTS IN 'mysql-bin-changelog.000123' FROM 12345 LIMIT 5;
   ```

   If this query also fails, the problem is on the source server and not in the ingestion gateway.

3. Check the binlog retention setting and the free disk space on the source server. See [Binlog purged before processing](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-troubleshoot.md#binlog-purged-before-processing) for how to set retention.

If you contact Databricks support, include the output of the first two queries and the full error message.

### <a id="gateway-issues" />Ingestion gateway issues

The issues in this section apply to gateway-based pipelines. Integrated CDC pipelines don't use an ingestion gateway. For integrated CDC troubleshooting, see [Troubleshooting](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-integrated-pipeline.md#troubleshoot).

#### Gateway not starting

**Problem**: Ingestion gateway fails to start or immediately fails.

**Possible causes and solutions**:

1. **Connection issues**: Verify the connection works (see [Connection issues](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-troubleshoot.md#connection-issues)).

2. **Insufficient compute resources**:
   * Check cluster creation permissions and policies.

3. **Staging volume issues**:
   * Verify you have `CREATE VOLUME` privileges on the staging schema.
   * Check that the staging catalog isn't a foreign catalog.

#### Gateway running but not capturing changes

**Problem**: Gateway is running but new changes aren't being captured.

**Possible causes and solutions**:

1. **Binlog retention too short**:
   * Increase binlog retention.
   * Monitor binlog files to ensure they're not purged too quickly.

2. **Network interruptions**:
   * Check for network connectivity issues.
   * Review gateway logs for connection errors.

### <a id="pipeline-issues" />Ingestion pipeline issues

#### Tables not being ingested

**Problem**: Some tables are not being ingested even though they're selected.

**Possible causes and solutions**:

1. **Spatial data types**:
   * Tables with spatial columns can't be ingested.
   * Exclude these tables from ingestion.

2. **Missing privileges**:

   * Verify the replication user has `SELECT` on all source tables.

   ```sql
   SHOW GRANTS FOR 'lakeflow_connect_user'@'%';
   ```

#### Large-object values are empty in the destination table

**Problem**: A text or binary column is empty in the destination table, but the source row has a value.

**Cause**: The source value is larger than 10 MiB (10,485,760 bytes). The connector ingests oversized large-object values as empty without failing the pipeline update or reporting an error, and you can't change this limit. See [Large-object size limit](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/mysql-limits.md#lob-size-limit).

### <a id="logs" />Checking logs

To diagnose issues, check the following logs:

1. **Gateway logs** (gateway-based pipelines only):
   * Navigate to the gateway pipeline in the Databricks UI.
   * Click on the latest run.
   * Review cluster logs and DLT event logs.

2. **Pipeline logs**:
   * Navigate to the ingestion pipeline.
   * Click on the latest run.
   * Review DLT event logs and any error messages.

3. **MySQL logs**:
   * Check the MySQL error log for connection or replication issues.
   * Review binlog files if position errors occur.

### Get help

If you continue to experience issues:

1. Collect relevant information:
   * Error messages from pipeline logs.
   * Gateway cluster logs.
   * MySQL version and deployment type.
   * Source configuration (binlog settings, retention).

2. Contact Databricks support with the collected information.

## TLS server certificate errors

For troubleshooting TLS server certificate validation errors, see [Troubleshoot TLS certificate errors](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/tls-server-certificate-validation.md#troubleshoot-tls-certificate-errors).
