# MariaDB

## Introduction

MariaDB is a popular open-source relational database management system that originated as a fork of MySQL. It remains fully compatible with MySQL while offering additional features and improved performance in some scenarios. It’s widely used in enterprise and cloud environments for its flexibility, speed, and reliability.

Now you can seamlessly synchronize data across all your CRM and database systems using **StacksSync**!

## Things to keep in mind

### During setup

* [x] **All MariaDB existing tables must have a (single) primary key**\
  We use the primary key to keep your data in sync.\
  The primary key must be a single column; composite primary keys are not supported.
* [x] **Primary keys must be auto-generated**\
  Ensure your primary keys are auto-generated by your database (e.g. use `AUTO_INCREMENT` for primary keys).
* [x] **Check user permissions**\
  Verify that the MariaDB user used by Stacksync to connect to your database has sufficient privileges (e.g., `SELECT`, `INSERT`, `UPDATE`, and `DELETE`) on the tables you want to map.
* [x] **Run this query to check if Stacksync can create triggers:**

  ```sql
  SELECT
    CASE
      WHEN @@log_bin = 0 THEN '✅ Binary logging is OFF — No issues.'
      WHEN @@log_bin = 1 AND @@log_bin_trust_function_creators = 1 THEN '✅ Binary logging is ON — Trust is enabled — All good.'
      ELSE '⚠️  Binary logging is ON but trust_function_creators is OFF — Please fix to allow trigger creation.'
    END AS status;
  ```

  if you see ⚠️, it means you need to update the server settings (requires admin access).

  ```sql
  SET GLOBAL log_bin_trust_function_creators = 1;
  ```

  **Reason:**\
  Stacksync creates deterministic triggers for internal logging and syncing.\
  By default, MariaDB restricts non-super users from creating triggers when binary logging is enabled — unless `log_bin_trust_function_creators` is set to `ON`.

  Feel free to reach out to us at <hello@stacksync.com>.

If a table in your database does not appear in Stacksync, one of the above conditions is likely not met. Check out our MariaDB snippets collection for troubleshooting tips.

### After setup

Renaming schema, tables, or columns will break Stacksync configuration. But don't worry, we've got you covered! Refer to our [Update Sync Configuration](https://docs.stacksync.com/two-way-sync/features/update-sync-configuration) guide for detailed steps to address this.
