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

# How to connect

> How to connect the MySQL data source to Adriel: create a read-only database user, allowlist Adriel's IP, and enter host, port, database, and credentials.

MySQL is an open-source relational database, and the connector binds a single table in a customer-managed MySQL or MariaDB database to an Adriel data source. SQL is generated automatically from each widget's configuration and routed through Adriel's database proxy, so transactional tables, application logs, and custom analytics tables appear in dashboards alongside marketing data.

## Before you connect

The following are required:

* A reachable MySQL or MariaDB deployment (self-hosted, AWS RDS, Cloud SQL, or equivalent).
* A read-only database user with `SELECT` rights on the target tables. The connector only reads, so no write privileges are needed.
* A host pattern on that user that accepts connections from Adriel's proxy. MySQL grants are scoped to the part after the `@` in a user definition, so a user must be defined with a pattern such as `'reporting'@'%'` (or one that matches `52.79.160.224`), not `'reporting'@'localhost'`.
* Firewall or security-group rules that allow inbound TCP from Adriel's egress address, `52.79.160.224`, to the database port (typically `3306`).
* Connection details to enter in the form: host, port, database name, username, and password.

A typical statement to create the read-only user looks like this:

```sql theme={null}
CREATE USER 'reporting'@'%' IDENTIFIED WITH mysql_native_password BY '<strong-password>';
GRANT SELECT ON your_database.* TO 'reporting'@'%';
FLUSH PRIVILEGES;
```

## Connect MySQL

<Steps>
  <Step title="Open the MySQL connector">
    On the **Data Sources** page, search for **MySQL** and select it.
  </Step>

  <Step title="Enter the connection details">
    Fill in the fields for the target database. The same connector serves MariaDB.

    | Field                        | Required | Description                                                                                                  |
    | ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
    | **Host**                     | Yes      | Database hostname. If it sits behind a firewall, allowlist `52.79.160.224` in the host or provider settings. |
    | **Database**                 | Yes      | Name of the database to import.                                                                              |
    | **User**                     | Yes      | A user with read access to the database.                                                                     |
    | **Password**                 | Yes      | Password for the database user.                                                                              |
    | **Port**                     | Yes      | Database port. The MySQL default is `3306`.                                                                  |
    | **Alternative Channel Name** | No       | Optional display name for the data source.                                                                   |
  </Step>

  <Step title="Select the table and submit">
    Choose the **table** to bind as the data source, then click **Submit**. One Adriel data source binds to exactly one table; to combine tables, pre-join them into a MySQL view and bind the view. Initial data availability can take up to one business day.
  </Step>
</Steps>

## What gets imported

Each widget load compiles into a single `SELECT` against the bound table, with a `WHERE` derived from widget filters and a `GROUP BY` from breakdowns. Numeric columns aggregate into metrics, while text, date, and other columns surface as breakdowns.

For the complete metric list, column type mapping, filter-operator coverage, caching, and limits, see the [MySQL data reference](/data-sources/g-n/mysql/data-reference).

## Troubleshooting

<AccordionGroup>
  <Accordion title="Access denied for user">
    The configured user does not exist, has the wrong password, or its host pattern does not match Adriel's egress address. Recreate the user, update the password, or widen the host pattern to include `52.79.160.224` (for example `'reporting'@'%'`).
  </Accordion>

  <Accordion title="ER_NOT_SUPPORTED_AUTH_MODE">
    MySQL 8 defaults new users to the `caching_sha2_password` authentication plugin, which the connector cannot negotiate. Alter the user to use `mysql_native_password` instead:

    ```sql theme={null}
    ALTER USER 'reporting'@'%' IDENTIFIED WITH mysql_native_password BY '<strong-password>';
    FLUSH PRIVILEGES;
    ```

    MariaDB is wire-protocol compatible and is not affected by this MySQL 8 default.
  </Accordion>

  <Accordion title="Connection timeout or refused">
    The database is unreachable from Adriel's egress address, or the TLS settings disagree. Open the firewall to `52.79.160.224`, verify the host and port, and confirm any SSL setting matches the server configuration.
  </Accordion>

  <Accordion title="A filter operator other than IN is needed">
    Widget filters on MySQL data sources support the `IN` operator (and its negation) only. For richer filtering (`LIKE`, numeric or date ranges, regular expressions), define a MySQL view that applies the predicate and bind the view as the data source.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="MySQL data reference" href="/data-sources/g-n/mysql/data-reference">
    Query model, field type mapping, caching, and limits for the MySQL data source.
  </Card>

  <Card title="MySQL FAQs" href="/data-sources/g-n/mysql/faqs">
    Common questions, IP whitelisting, and expected behaviors for the MySQL data source.
  </Card>

  <Card title="How to connect MongoDB" href="/data-sources/g-n/mongodb/how-to-connect">
    Connect a MongoDB database with a form-driven column pre-filter.
  </Card>

  <Card title="How to connect Postgres" href="/data-sources/o-z/postgres/how-to-connect">
    Connect a PostgreSQL database with a richer filter-operator set.
  </Card>

  <Card title="How to connect Redshift" href="/data-sources/o-z/redshift/how-to-connect">
    Connect an Amazon Redshift data warehouse.
  </Card>
</CardGroup>
