How to Configure n8n MariaDB Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an n8n mariadb approval flow by pausing workflows before queries run. A human reviewer then checks the SQL statement and approves or rejects it. Teams build these checks when automated workflows or AI agents query live databases. Without a review step, an broad database role can change or delete critical rows. A single bad query from an agent can break production tables in seconds. How an n8n mariadb approval workflow operates In n8n, the AI Agent node pairs a chat model with one o

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 mariadb approval flow by pausing workflows before queries run. A human reviewer then checks the SQL statement and approves or rejects it. Teams build these checks when automated workflows or AI agents query live databases. Without a review step, an broad database role can change or delete critical rows. A single bad query from an agent can break production tables in seconds.

How an n8n mariadb approval workflow operates

In n8n, the AI Agent node pairs a chat model with one or more tools. The agent decides which tool to call to finish its task. You must attach at least one tool sub-node to the AI Agent node. Starting in n8n 1.82.0, all AI Agent nodes run as a Tools Agent. The older agent type setting is removed in n8n 3.0. For SQL tasks, n8n docs recommend a MySQL tool sub-node on an Agent node. Because MariaDB uses the MySQL protocol, teams use the MySQL tool for MariaDB.

To add a manual review step, builders avoid direct database tool calls for writes. Instead, they attach the Call n8n Workflow Tool or a Custom Code Tool. The agent drafts a SQL query and passes it to a child workflow. That child workflow sends the query text to a chat app or email. The workflow then waits for a human to click an approval button. Only after approval does the workflow send the SQL statement to the MariaDB node.

What native MariaDB roles and workflow pauses solve

Pairing MariaDB user roles with n8n workflow pauses solves basic access control issues. Database admins can create a read-only MariaDB user for general agent lookups. They can then create a separate write user for the approved child workflow. This split stops the AI agent from running destructive commands on its own. It also gives the team a basic record of which workflow requested a change.

Still, this native setup leaves a major operational gap in daily work. Database users and roles only decide who can log in to MariaDB. They do not inspect what individual SQL statements do in flight. If an agent uses a MySQL tool sub-node directly, it skips the child workflow. Even with a workflow wait step, reviewers only see raw text in chat. They do not have automatic data masking for sensitive output columns.

Approval Chains & Escalation + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why query-level controls matter for AI agents

When an AI agent reads a table, results return to the chat model. Those rows often hold private details like emails, phone numbers, or card numbers. Native MariaDB grants allow or block whole tables or columns for a user. They do not rewrite matched fields in results dynamically based on context. If the database user has read rights, every row in that table flows back by default.

Also, building custom wait nodes in every n8n workflow takes constant upkeep. One builder might forget to route a new agent through the child workflow. Another builder might reuse a shared database key with broad write permissions. When the check lives inside the workflow canvas, a small edit can bypass it. Teams need a way to enforce query reviews and field masking outside the app.

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 runs beside the database as a sidecar for your MySQL. It keeps your login setup and drivers as they are while checking queries on the wire.

With hoop.dev MySQL support, guardrails refuse bad queries before they run and return a readable MySQL error. 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 I use the n8n SQL Agent for MariaDB workflows?

The standalone SQL Agent is deprecated in recent versions of n8n. You should use a recent AI Agent node with a MySQL tool sub-node instead.

How do I stop an n8n AI agent from dropping MariaDB tables?

First, give the agent a MariaDB user role that only has read permissions. Second, require a human approval step before any write or delete query runs.

Does MariaDB mask sensitive fields for n8n agents out of the box?

No, standard MariaDB table grants only permit or deny access to columns. You need dynamic data masking to rewrite emails or card numbers in query results.

The query runs. The emails stay hidden.