> ## Documentation Index
> Fetch the complete documentation index at: https://artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MariaDB Source Connector: Setup and Configuration

> Configure MariaDB as a source in Artie with binlog replication, service account setup, and GTID support through Artie's MySQL connector.

Artie connects to MariaDB with its MySQL connector. It detects MariaDB from the server version and switches to MariaDB's binlog and GTID handling automatically, so there is nothing MariaDB-specific to configure in the Artie dashboard.

## What you'll need

* Database connection details
* A service account
* `binlog_format` set to `ROW`
* At least 24 hours of binlog retention

## Setup

<Steps>
  <Step title="Create a service account">
    Run the following SQL to create a dedicated user for Artie:

    ```sql setup.sql theme={null}
    CREATE USER 'artie' IDENTIFIED BY 'password';
    -- SELECT is required for backfills.
    -- REPLICATION CLIENT and REPLICATION SLAVE are required for Artie to read the binary log.
    GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'artie';
    ```

    <Note>
      On MariaDB 10.5.2 and later, `REPLICATION CLIENT` is an alias for `BINLOG MONITOR`, so the same statement works on every version.
    </Note>
  </Step>

  <Step title="Enable binlog (ROW format)">
    Binary logging must be enabled with `binlog_format` set to `ROW`.

    <Tabs>
      <Tab title="Amazon RDS for MariaDB">
        <Steps>
          <Step title="Create a parameter group">
            Navigate to **RDS** > **Parameter groups** > **Create parameter group**. Select the MariaDB family that matches your version.
          </Step>

          <Step title="Set binlog_format to ROW">
            Open the new parameter group, search for `binlog_format`, and set it to `ROW`.
          </Step>

          <Step title="Apply the parameter group">
            Associate the parameter group with your RDS instance, then reboot the database for the change to take effect.
          </Step>
        </Steps>

        <Note>
          RDS only writes binary logs when automated backups are enabled. Make sure the backup retention period is greater than 0.
        </Note>
      </Tab>

      <Tab title="Self-hosted MariaDB">
        Add the following to your MariaDB configuration file (`my.cnf`, or a file under `/etc/mysql/mariadb.conf.d/`):

        ```ini theme={null}
        [mysqld]
        log_bin = mariadb-bin
        binlog_format = ROW
        ```

        Then restart the MariaDB server.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Set binlog retention period">
    Artie requires at least 24 hours of binlog retention.

    <Tabs>
      <Tab title="Amazon RDS for MariaDB">
        ```sql theme={null}
        CALL mysql.rds_set_configuration('binlog retention hours', 24);
        ```
      </Tab>

      <Tab title="Self-hosted MariaDB">
        MariaDB keeps binary logs until they are purged, which is the default. If you have set an expiry, make sure it is at least 24 hours:

        ```sql theme={null}
        -- MariaDB 10.6.1 and later
        SET GLOBAL binlog_expire_logs_seconds = 86400;
        -- Earlier versions
        SET GLOBAL expire_logs_days = 1;
        ```

        Add the same setting to your configuration file so it survives a restart.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Create the source in Artie">
    When you create a pipeline, choose **MariaDB** as the source and enter your connection details. Artie creates a MySQL connector for it, so the source is listed as MySQL afterwards.
  </Step>
</Steps>

## Additional features

* **GTID support** - with `gtid_strict_mode` enabled, Artie resumes replication from GTIDs instead of binlog file positions.

<Accordion title="Enabling GTID">
  MariaDB writes GTIDs to the binary log by default. Artie uses them once `gtid_strict_mode` is on, because strict mode guarantees that sequence numbers only increase within each replication domain.

  ```sql theme={null}
  SET GLOBAL gtid_strict_mode = ON;
  ```

  Add `gtid_strict_mode = ON` to your configuration file as well (on RDS, set it in the parameter group). You can verify the settings with:

  ```sql theme={null}
  SHOW VARIABLES LIKE 'gtid_strict_mode';
  SELECT @@gtid_binlog_pos;
  ```

  `gtid_strict_mode` should be `ON` and `gtid_binlog_pos` should not be empty.

  <Info>
    Without strict mode, Artie still replicates MariaDB by binlog file and position. Once strict mode is on, Artie detects it on the next restart and switches to GTID-based replication. No configuration is needed in the Artie dashboard.
  </Info>
</Accordion>

## Frequently asked questions

### Which MariaDB versions are supported?

Artie supports MariaDB 10.6, 10.11, and 11 or higher. Amazon RDS for MariaDB uses the same setup, with the parameter group and retention steps shown above.

### Can I replicate from a read replica?

Yes, if the replica writes replicated changes to its own binary log. Artie reads the replica's local binary log, not its relay log.

Configure the replica with:

* `log_bin` enabled
* `binlog_format = ROW`
* `log_slave_updates = ON`
* A healthy replication connection
* At least 24 hours of local binlog retention

Use these queries on the replica to verify its configuration:

```sql theme={null}
SHOW VARIABLES WHERE variable_name IN ('log_bin', 'binlog_format', 'log_slave_updates');
SHOW SLAVE STATUS;
SHOW BINARY LOGS;
```

### How do I verify that binlog is enabled?

Run the following queries on your MariaDB server:

```sql theme={null}
SHOW VARIABLES LIKE 'log_bin';
SHOW VARIABLES LIKE 'binlog_format';
SHOW MASTER STATUS;
```

`log_bin` should be `ON`, `binlog_format` should be `ROW`, and `SHOW MASTER STATUS` should return the current binlog file and position.

### What happens if binlog retention is too short?

If binlog files are purged before Artie can read them, the pipeline will need to re-snapshot the affected tables. We recommend at least 24 hours of retention to provide a comfortable buffer.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.