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

# MySQL

> Connect MySQL to query your database and analyze your data with natural language

Connect Adapt to MySQL to query your database and analyze your data using
natural language. Adapt connects to your MySQL-compatible database directly, so
you can explore tables and pull insights without writing SQL by hand.

## Set up credentials

Gather these connection details from your MySQL database before connecting:

<Steps>
  <Step title="Find your host and port">
    Locate your database **host** (the server address, for example
    `db.example.com` or an IP) from your database provider or server config.
    MySQL uses port `3306` by default.
  </Step>

  <Step title="Identify your database name">
    Determine the **database** (schema) you want Adapt to query. You can list
    databases with `SHOW DATABASES;` if you are unsure.
  </Step>

  <Step title="Create a read-only user (recommended)">
    For safety, create a dedicated user with read-only access and grant it
    `SELECT` on the database you want Adapt to read, rather than using an admin
    account. Note the **user** and **password**.
  </Step>
</Steps>

<Note>
  If your database is behind a firewall or private network, make sure the host is
  reachable and that any required IP addresses are allowlisted.
</Note>

## Connect to Adapt

<Steps>
  <Step title="Open Integrations">
    In Adapt, go to **Settings > Integrations**.
  </Step>

  <Step title="Find MySQL">
    Search for **MySQL** and select it from the catalog.
  </Step>

  <Step title="Start the connection">
    Click **Connect** to open the connection form.
  </Step>

  <Step title="Add your credentials">
    Enter the values you gathered above, then click **Add connection**:

    | Secret Name      | Value                  |
    | ---------------- | ---------------------- |
    | `MYSQL_HOST`     | Your database host     |
    | `MYSQL_USER`     | Your database user     |
    | `MYSQL_PASSWORD` | Your database password |
    | `MYSQL_DATABASE` | Your database name     |

    You can rename the connection and choose whether it is shared with your
    organization or kept personal to you.
  </Step>

  <Step title="Test the connection">
    Ask Adapt to list your tables or query your data.
  </Step>
</Steps>

### Security

* Credentials are encrypted at rest with AES-256
* Use a dedicated user with read-only (`SELECT`-only) privileges
* Connect over SSL/TLS whenever your server supports it
* Restrict network access to your database and allowlist only trusted addresses
* Never share your credentials publicly or commit them to source control

## Capabilities

Adapt can query your MySQL database. Explore your tables and analyze your data
using natural language.

### Examples

Explore data:

```
What tables are in my MySQL database?
```

Inspect a table:

```
Show me the columns and types in the orders table.
```

Summarize records:

```
How many orders were placed in the last 7 days?
```

Analyze trends:

```
What are my top 10 customers by total spend this year?
```
