How to Configure n8n MariaDB Connect

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an n8n mariadb connect link by adding database credentials to a workflow node. For AI tasks, attach a MySQL tool sub-node to an AI Agent node. Teams often use a single shared database account to make this setup fast. Broad database roles let workflows or AI models run wide queries across your tables. How the native n8n mariadb connect flow works In standard workflows, an n8n node holds your MariaDB host details and login keys. The workflow uses these stored credentials to log in an

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 connect link by adding database credentials to a workflow node. For AI tasks, attach a MySQL tool sub-node to an AI Agent node. Teams often use a single shared database account to make this setup fast. Broad database roles let workflows or AI models run wide queries across your tables.

How the native n8n mariadb connect flow works

In standard workflows, an n8n node holds your MariaDB host details and login keys. The workflow uses these stored credentials to log in and run queries on schedule. When you build AI workflows, the architecture changes to use the AI Agent node. The AI Agent node pairs a chat model with one or more tool sub-nodes. You must attach at least one tool sub-node to the AI Agent node. The agent then decides which tools to call to finish a task.

Starting in n8n 1.82.0, the old agent type setting is deprecated. Every AI Agent node now runs as a Tools Agent by default. Node version 1 and the old SQL Agent are removed in n8n 3.0. For database tasks, the docs tell you to attach a MySQL tool sub-node instead. MariaDB speaks the MySQL wire protocol, so it uses this same tool pathway. You can also attach a Call n8n Workflow Tool or a Custom Code Tool.

How to scope database roles for workflow nodes

A safe setup starts inside MariaDB before you ever open your workflow editor. Create a dedicated database user just for your n8n workflows and AI agents. Grant this user read access only to the exact tables the workflow needs. Do not reuse an admin account or an app write role for agent tools. If a workflow only reads order status, block access to user profile tables.

In the deprecated SQL Agent, teams could list included tables in the node options. With the modern Tools Agent, you control table scope through database grants and sub-workflows. Using the Call n8n Workflow Tool lets you wrap a fixed query inside a sub-workflow. The agent passes inputs to the sub-workflow instead of writing raw SQL from scratch.

What native database roles solve and what keeps the session active

Native MariaDB roles and n8n credential stores solve the initial login problem well. They verify who can log in and which tables that account can touch. This stops an agent tool from reading tables outside its assigned schema.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, static database credentials do not inspect individual queries in flight. Once the node logs in, MariaDB trusts every statement that fits the role grants. If an allowed table holds emails, phone numbers, or card numbers, queries return them. A chat model can pull thousands of rows or expose national IDs in prompts. Native settings also store long-lived database passwords directly inside the workflow tool.

Static grants cannot pause a risky write query for human approval before it runs. They also do not mask sensitive fields in query results before the agent reads them. Teams need controls that check each statement and rewrite sensitive data on the fly.

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

Attach a MySQL tool sub-node or a Call n8n Workflow Tool to the AI Agent. From n8n 1.82.0 onward, all AI Agent nodes run as a Tools Agent. The old standalone SQL Agent is deprecated and replaced by tool sub-nodes.

Why should I avoid giving the n8n database user full table grants?

The AI Agent decides which tools to call based on user prompts and chat context. If the database role has broad grants, a bad prompt can read or change extra rows. Scoping the MariaDB role to specific tables limits what the tool can touch.

Can native MariaDB permissions hide sensitive columns in query results?

MariaDB column grants can block a query from running if it asks for restricted columns. Still, native grants do not rewrite emails or card numbers inside allowed query results. To replace sensitive values while keeping queries working, you need result masking in flight.

The query runs. The emails stay hidden.