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

# MySQL

## Overview

Stigg's integration with MySQL allows you to export your product catalog, customer, and subscription data directly to your MySQL database for custom reporting and analysis.

If you're connecting a PlanetScale database, use this MySQL destination — PlanetScale is MySQL-compatible and is connected the same way.

<Note>
  Stigg's native data export integrations are included in the Scale plan, and are also available as an optional add-on to the Growth plan. See Stigg's pricing for more details.
</Note>

<Card title="View the full entity schema" icon="sitemap" href="./schema">
  See every table and column exported to your destination, organized by entity group.
</Card>

## Setting up the integration

### Prerequisites

You'll need a MySQL instance with a database and a user that has permission to create tables and write data in the target schema. MySQL 8.0 and above is fully supported; MySQL 5.7 is supported on a best-effort basis.

If your database is protected by security groups or other firewall settings, you'll need Stigg's static IP (shown in the connect form) to complete the first step below.

<Steps>
  <Step title="Allow access">
    Configure your firewall or security group to permit:

    * Incoming connections to your host and port (usually `3306`) from Stigg's static IP
    * Outgoing connections from ports `1024`–`65535` to that same IP

    <Note>
      If your database isn't accessible from the public internet, SSH tunneling through a bastion host is supported. Allow inbound SSH (port `22`) from Stigg's static egress IP on the bastion host, create an SSH user with Stigg's public key in `~/.ssh/authorized_keys` ([contact Stigg support](mailto:support@stigg.io) for the key), and grant the bastion host's IP access to the database port in place of the static egress IP. Provide the bastion host address, port, and username in the connection form.
    </Note>
  </Step>

  <Step title="Create a writer user">
    Create the database user Stigg will connect as, and grant it the required privileges:

    <CodeGroup>
      ```sql Create user theme={null}
      CREATE USER <username>@'%' IDENTIFIED BY '<some-password>';
      GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, CREATE VIEW ON *.* TO <username>@'%';
      ```
    </CodeGroup>

    If you're pre-creating the schema rather than letting Stigg create it on first sync, grant privileges on that schema only instead:

    <CodeGroup>
      ```sql Grant on pre-created schema theme={null}
      GRANT ALL PRIVILEGES ON <database_name>.* TO <username>@'%';
      ```
    </CodeGroup>

    <Warning>
      Avoid special characters (`@`, `[`, `]`, `/`, `?`, `#`, `"`, `\`, `+`, spaces, `&`, `:`, `%`) in the username and password — they can break connection string parsing.
    </Warning>
  </Step>

  <Step title="Connect Stigg with MySQL">
    In [Stigg](https://app.stigg.io/), navigate to **Integrations > Apps > MySQL**.

    Enter the following information in the connection form:

    | Field    | Description                                        |
    | -------- | -------------------------------------------------- |
    | Host     | The hostname or IP address of your MySQL server    |
    | Port     | The port MySQL listens on. Defaults to `3306`.     |
    | Database | The name of the target database                    |
    | Schema   | The schema where Stigg will create and sync tables |
    | Username | The MySQL user Stigg will authenticate as          |
    | Password | The password for the MySQL user                    |

    Click **Test & connect**.
  </Step>

  <Step title="Select entities to export">
    After entering your connection details, expand the **Entities to export** section to choose which entity groups to include in the sync. All groups are selected by default.

    See [Exported entities](./overview#exported-entities) for a description of each group.
  </Step>
</Steps>


## Related topics

- [Exported entities](/documentation/importing-and-exporting-data/export/overview.md#exported-entities)
- [Sync process, schedule, manual sync, and sync history](/documentation/importing-and-exporting-data/export/overview.md#sync-process)
