How to Configure n8n MySQL Approval
You set up an n8n mysql approval flow by pausing runs before a query executes. A human reviewer must check the generated SQL statement before the database tool runs it. Teams often wire a chat model directly to a MySQL tool sub-node in n8n. When that database role has broad permissions, an unreviewed query can alter production tables. How an n8n mysql approval workflow works In n8n, the AI Agent node pairs a chat model with one or more tools. The agent decides which tool sub-node to call to f
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 an n8n mysql approval flow by pausing runs before a query executes. A human reviewer must check the generated SQL statement before the database tool runs it. Teams often wire a chat model directly to a MySQL tool sub-node in n8n. When that database role has broad permissions, an unreviewed query can alter production tables.
How an n8n mysql approval workflow works
In n8n, the AI Agent node pairs a chat model with one or more tools. The agent decides which tool sub-node to call to finish its task. From n8n 1.82.0 onward, all AI Agent nodes run as a Tools Agent. The older agent type setting is deprecated and removed in n8n 3.0. For database tasks, n8n recommends attaching a MySQL tool sub-node to a recent Agent node.
A basic MySQL tool sub-node executes queries as soon as the agent calls it. To add a review step, teams split query creation from query execution. First, the agent or a separate workflow step drafts the SQL query as plain text. Next, the workflow sends that query text to a chat channel or email for review. The workflow pauses and waits for a human to approve or reject the request. Only after a reviewer clicks approve does the workflow pass the query to MySQL.
Teams also use the Call n8n Workflow Tool to keep this review step modular. The main AI Agent node calls a sub-workflow instead of calling the database tool directly. That sub-workflow holds the wait step and the final MySQL execution step. This pattern keeps the agent logic clean while forcing a check on every call.
Setting up least-privilege MySQL roles for n8n
Workflow approvals work best when paired with strict database roles in MySQL. Every MySQL tool sub-node in n8n logs in using a stored database credential. If that credential uses an admin role, any approved query can drop tables. Teams should create a dedicated MySQL user just for the n8n workflow.
Start by granting read-only select permissions on the specific tables the agent needs. If the workflow must write data, limit insert or update rights to those exact tables. Never share a single MySQL user across multiple workflows that have different risk levels. Separate credentials let you track which workflow ran a query in the database logs. You can also revoke a single workflow credential without breaking other automations.
Approval Chains & Escalation + MySQL Access Governance: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native workflow approvals solve and what keeps the session active
Building an approval step inside n8n stops an agent from running surprise writes on its own. It gives an engineer a chance to read the SQL text before execution. Pairing that step with a narrow MySQL role limits which tables the workflow can touch.
Still, workflow-level checks and static database roles leave an operational gap open. Anyone who can edit the n8n canvas can bypass the wait step by rewiring nodes. The stored MySQL credential still sits inside the workflow tool for any node to use. Also, static MySQL roles decide who logs in, not what individual statements do in flight. A valid select query can still pull thousands of customer emails, phone numbers, or card numbers. Native workflow pauses do not rewrite matched fields in query results before the model reads them.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL. It runs next to MySQL, RDS, or Aurora and reads the MySQL wire protocol.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails. When a rule refuses a query, MySQL returns a native error packet with your message. On the response path, hoop.dev data masking rewrites string values in returned rows that match your rules. Every query and decision is logged per resource. See the MIT-licensed project on GitHub.
Frequently asked questions
Should I use the SQL Agent or a MySQL tool sub-node in n8n?
You should use a MySQL tool sub-node attached to a recent AI Agent node. In n8n 1.82.0, the standalone SQL Agent type is deprecated. Node version 1 is removed in n8n 3.0, and all agents work as a Tools Agent.
Can an n8n AI Agent node pause for approval inside the tool call itself?
A standard MySQL tool sub-node runs queries right away when the agent calls it. To force a pause, route the agent through a Call n8n Workflow Tool. That sub-workflow can pause for human input before running the database step.
Does a read-only MySQL user protect sensitive columns from the AI model?
A read-only role stops the agent from changing or deleting rows in your database. Still, the role still returns full table rows to the n8n workflow. Without data masking in flight, the chat model receives raw emails, phone numbers, and card numbers.
Related guides
In this post