How to Configure Amazon Q MySQL Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up amazon q mysql approval by pausing agent commands before they run. Then a human or a rule checks the query before the database gets it. Many teams start by giving the AI agent a local database role. That role often has broad rights to read and write tables. When roles are too broad, one bad prompt can drop a live table. It can also pull thousands of customer emails into the chat window. How amazon q mysql approval works in practice Amazon Q Developer helps engineers write code and

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up amazon q mysql approval by pausing agent commands before they run. Then a human or a rule checks the query before the database gets it. Many teams start by giving the AI agent a local database role. That role often has broad rights to read and write tables. When roles are too broad, one bad prompt can drop a live table. It can also pull thousands of customer emails into the chat window.

How amazon q mysql approval works in practice

Amazon Q Developer helps engineers write code and run shell commands from their editor. It can also use external tools to talk to a MySQL database. When the agent needs to check a schema, it builds a SQL query. By default, the local client asks the user to click approve or deny. The user reads the proposed command in their editor or terminal window. If the command looks safe, the user lets it run. The agent then uses the local MySQL login keys to run the statement.

Teams also use database roles to limit what the agent can do. An admin might make a read-only MySQL user just for the coding agent. This setup blocks the agent from changing rows or dropping tables. If the agent needs to change data, it must ask a human first. The human then takes the query and runs it with a higher role.

What native checks solve and what they miss

Local prompts and database roles solve the first problem of who can log in. They stop an agent from running wild in the background without any notice. A read-only MySQL role also stops accidental writes and table drops. For local test databases with fake data, this basic setup works well.

Still, local prompts leave big gaps when agents touch shared or live databases. Developers get tired of reading dozens of prompts every hour. Soon they click approve out of habit without checking the full SQL text. Even worse, developers often turn on auto-run modes to move faster. Once auto-run is on, the local check is gone.

Approval Chains & Escalation + MySQL Access Governance: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Database roles also lack fine control over what happens during a session. A MySQL role decides who logs in and which tables they can read. It does not check what each query does in flight. If an agent has read rights on a user table, it can read everything. It can pull raw emails, phone numbers, card numbers, and national IDs. Those fields go straight into the model prompt and external logs. Also, when a developer approves a query locally, no central team sees it. Security teams have no central log of who approved the query or why. They only see that a shared database user ran a statement.

Why team review beats local prompts for write queries

When an agent needs to update data, the user should not approve it alone. Self-approval in a local editor does not meet strict audit rules. Instead, a peer or team lead should check the statement in chat. Peer review catches bad joins and missing filters before the query runs. It also creates a clear record of who asked for the change. The log shows who approved it and the exact SQL that ran. Combining peer checks with field masking keeps both data and tables safe. Masking rewrites matched fields like emails and card numbers in query results. The agent gets the schema shape it needs while sensitive fields stay masked.

Add wire guardrails and masking beside MySQL

Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.

With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.

Frequently asked questions

Can Amazon Q run MySQL queries without asking me first?

Yes, if a user enables auto-run settings in their local tool, queries run right away. That is why database checks should sit outside the local editor.

Does a read-only MySQL role protect sensitive customer data from the model?

No, a read-only role still lets the agent select every column in a table by default. Without field masking, queries return raw emails, phone numbers, and card numbers to the agent.

How can we audit which queries the AI agent ran on our database?

Native MySQL logs only show the database user account, not the developer or prompt. You need a central check that ties every query to an individual user identity.

The query runs. The emails stay hidden.