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 Leme validates the connection before saving it.
analytics — and the connection URL:4
Enable it on your agents
Attach the connection to the agents that should use it.
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=truein 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
The connection fails to validate
The connection fails to validate
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.
A query was rejected as not read-only
A query was rejected as not read-only
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 agent says a table doesn't exist
The agent says a table doesn't exist
The read-only user probably doesn’t have
SELECT on that schema. Extend the grant in MySQL; no reconnection needed.Results seem cut off
Results seem cut off
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.