Skip to main content
Connect a MySQL database and your agents answer data questions directly from the source: counts, lookups, trends, cross-checks. No dashboards to build, no CSV exports — ask the question, the agent explores the schema and writes the query. This integration cannot write. Every query is checked before it runs: only SELECT statements are accepted; inserts, updates, deletes, schema changes, locks, and multi-statement tricks are all rejected. Even so, we recommend connecting with a read-only database user — defense in depth costs nothing.

What agents can do

Try asking

  • “How many orders did we take yesterday, and what was the total?”
  • “Which customers signed up this month but never placed an order?”
  • “What are the 10 best-selling products this quarter?”
  • “Is there anything unusual in support ticket volume this week?”
  • “What columns does the subscriptions table have?”

Connect a database

1

Create a read-only user

In MySQL, create a dedicated user for Leme and grant it SELECT only, on only the schemas agents should see:
2

Open Integrations

In the Leme dashboard, go to Integrations and select Database.
3

Enter the connection details

Give the connection an alias — a short name agents use to refer to this database, like analytics — and the connection URL:
Leme validates the connection before saving it.
4

Enable it on your agents

Attach the connection to the agents that should use it.
The database must be reachable from Leme’s servers. If your database only accepts connections from allowlisted addresses, contact support for the addresses to allow.

Permissions

The integration has no write actions, so there is nothing riskier to configure. Remember that “read” here means anything the connected user can SELECT — scope the MySQL user’s grants to the data agents should legitimately see, and keep personal or sensitive tables out of the grant.

Security notes

  • Credentials are stored encrypted and never shown to agents — agents send queries, Leme executes them server-side.
  • Use ?ssl=true in the connection URL so traffic to your database is encrypted in transit.
  • Rotating the password? Update it in MySQL, then reconnect in Integrations → Database with the new URL.

Troubleshooting

Check the pieces in order: host reachable from the internet, port correct (default 3306), user and password valid, database name present in the URL. The error message says which check failed.
Working as intended — the agent attempted something other than a plain SELECT. Rephrase the request as a question about data; if you actually need to change data, that’s outside what this integration allows.
The read-only user probably doesn’t have SELECT on that schema. Extend the grant in MySQL; no reconnection needed.
Query results are bounded to keep answers fast. For large questions, ask for aggregates (“totals per month”) instead of raw rows — the agent will push the work into SQL.