# How to connect MySQL to AI agents?

Connect a cloud-hosted MySQL database to Sequel and query it in natural language from the app or any MCP client.

Connect a cloud-hosted MySQL database to Sequel and query it in plain English — from the Sequel app or any AI tool wired up to the [MCP server](/docs/install). This works with managed MySQL anywhere: PlanetScale, Amazon RDS/Aurora MySQL, Google Cloud SQL, Azure Database for MySQL, and similar (MySQL 5.7+, including 8.x, and MariaDB 10.3+).

## What you'll need

- A **cloud-hosted MySQL** database reachable over the internet.
- A database **connection string** (host, port, database, user, and password).
- A user with **read access** to the schemas you want to query.

<Callout type="tip" title="Use a read-only user">
Create a dedicated read-only user for Sequel. It's the simplest way to guarantee queries can't modify your data, and it scopes access to just the tables you intend to expose.
</Callout>

## Connect it

<Steps>
<Step title="Open a new connection">
In the Sequel dashboard, go to **Connections → New connection** and choose **MySQL**.
</Step>

<Step title="Enter your connection string">
Paste your connection string. It usually looks like this:

<CodeBlock language="bash" label="Connection string">mysql://USER:PASSWORD@HOST:3306/DATABASE</CodeBlock>

Most managed providers require SSL — append the SSL parameters your provider documents (some need a CA certificate) if the connection is rejected without them.
</Step>

<Step title="Allow Sequel through your firewall">
Sequel connects to your database from a fixed set of IP addresses. If your database (or its provider's firewall/security group) restricts inbound traffic, add Sequel's egress IPs to the allowlist so the connection test can reach it.

The exact IPs to allowlist are shown on the connection screen — copy them from there into your provider's networking settings (e.g. RDS security groups, Cloud SQL authorized networks, PlanetScale/Azure IP allow).
</Step>

<Step title="Test and save">
Sequel verifies the credentials and reads your schema. A green check means it's live.
</Step>
</Steps>

## Try it

Once connected, ask things like:

- "Show me total sales by product category last quarter"
- "Which customers haven't placed an order in 90 days?"
- "Show me the top 20 users by total spend"

## Troubleshooting

| Symptom | Likely fix |
| --- | --- |
| Connection test times out | Database isn't reachable from the internet, or a firewall is blocking Sequel — add Sequel's egress IPs (shown on the connection screen) to your allowlist. |
| SSL/TLS connection error | Provider requires an encrypted connection — add the SSL parameters (and CA certificate, if needed) from your provider's docs. |
| Access denied for user | The user lacks a `SELECT` grant on the target database, or the credentials are wrong. |

## Related

- [Connecting your first data source](/docs/connecting-your-first-data-source)
- [Chatting with your data](/docs/chatting-with-your-data)
- [Browse all integrations](/docs/integrations)
