How to Configure Claude Code MySQL Approval
You set up claude code mysql approval by combining local agent prompts with database roles. You also give the agent a read-only database user in its connection string. Many engineering teams wire their coding agent straight into a local database client. They often reuse a broad developer account for speed during testing. When permissions are too wide, one bad prompt can alter rows or drop tables. A safe setup separates local tool prompts from actual database role limits. How claude code mysql
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 claude code mysql approval by combining local agent prompts with database roles. You also give the agent a read-only database user in its connection string. Many engineering teams wire their coding agent straight into a local database client. They often reuse a broad developer account for speed during testing. When permissions are too wide, one bad prompt can alter rows or drop tables. A safe setup separates local tool prompts from actual database role limits.
How claude code mysql approval works in practice
Claude Code reaches external systems through two main paths. First, it talks to tools and databases through Model Context Protocol servers. The vendor docs tell teams to use a read-only database user in the connection string. That rule stops the queries Claude runs from changing any stored data. The docs also warn users to check that they trust each MCP server before use. Second, the agent runs shell commands through its built-in Bash tool.
In Manual mode, the Bash tool asks for human approval before it runs commands. Only a small built-in list of safe read commands skips this prompt. When the agent wants to run a database client command, it pauses for your review. You read the proposed command on your screen and decide to allow or deny it. This manual check acts as the first gate before a query leaves your machine. Pairing Manual mode with a read-only MySQL role gives you two layers of control.
What native setup solves and what it leaves open
Local prompts and read-only MySQL accounts solve basic risk on a single laptop. A read-only user blocks write queries if the agent tries to change a table. Manual mode stops the Bash tool from firing off surprise shell scripts without your knowledge. These native controls decide which local user can log in to the database. They also let the developer sitting at the keyboard review raw shell strings.
Still, local settings do not manage how a whole team shares database access. Putting a database connection string on every laptop spreads long-lived secrets across many machines. Also, a read-only MySQL user can still read every column in an allowed table by default. If a table holds customer emails, phone numbers, or card numbers, the query returns them. Local prompts ask the same engineer who wrote the prompt to approve the command. They do not bring in a second reviewer for sensitive production checks. Finally, MySQL roles check who logs in, not what each query does in flight.
Claude Code Security + Approval Chains & Escalation: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Adding query-level review and data masking
Production databases need controls that work outside the developer laptop. Teams need a way to inspect individual SQL statements before the database runs them. When an agent sends a write query, a peer on the team should approve it. When an agent runs a select query, data masking should rewrite matched fields in results. Masking replaces emails, phone numbers, and national IDs before the output reaches the agent. Central audit logs should also record every query alongside the user identity.
Inspect every MySQL query and response in flight
Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.
First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.
Frequently asked questions
How does Claude Code connect to a MySQL database?
It connects through an MCP server configured with a database connection string. It can also invoke a local MySQL command-line client through its Bash tool.
Does Manual mode block every command by default?
Manual mode requires user approval for Bash commands except for built-in read-only file and git checks. Database client calls through Bash still pause and wait for your confirmation.
Why is a read-only MySQL user not enough for production data?
A read-only user blocks data changes, but it still returns raw rows from allowed tables. Without field masking, queries can pull sensitive emails, phone numbers, or card numbers into context.
Related guides
In this post