How to Configure n8n MariaDB Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up n8n mariadb credentials by adding a database account in your workflow app. You enter the host, database name, user, and password into a MySQL credential record. Teams often use one shared database user for many workflows and AI agents. If that account has broad rights, any workflow can change or delete critical tables. How to set up n8n mariadb credentials for workflows and agents MariaDB uses the same wire protocol as MySQL for client logins and queries. In n8n, you store your Mar

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 n8n mariadb credentials by adding a database account in your workflow app. You enter the host, database name, user, and password into a MySQL credential record. Teams often use one shared database user for many workflows and AI agents. If that account has broad rights, any workflow can change or delete critical tables.

How to set up n8n mariadb credentials for workflows and agents

MariaDB uses the same wire protocol as MySQL for client logins and queries. In n8n, you store your MariaDB login details inside the MySQL credential store. You first create a new database user inside your MariaDB server for the app. You grant that user access to the specific database and tables your workflows need.

Next, you open your workflow app and add a new MySQL credential entry. You fill in the server host, port, database name, username, and secret password. You also turn on TLS settings if your database requires encrypted network traffic. Once saved, you attach this credential to your database node or agent tool.

Many teams now connect database credentials to an n8n AI Agent node. The AI Agent node pairs a chat model with one or more tool sub-nodes. The agent decides which tools to call in order to finish a user task. You must attach at least one tool sub-node to an AI Agent node.

From n8n 1.82.0 onward, the old agent type setting is deprecated. Every AI Agent node now runs as a Tools Agent by default. Node version 1 with the old setting is removed in n8n 3.0. For database tasks, the docs advise using a MySQL tool sub-node with an agent.

Why static database accounts fall short in automated workflows

Before the Tools Agent change, n8n offered a standalone SQL Agent mode. That SQL Agent could read natural language questions and turn them into SQL queries. It could then run the queries against MySQL, SQLite, or Postgres and show results. Whether you use standard nodes or AI tools, static logins create real risks.

Database logins only check who can log in at the start of a session. They do not inspect what each query does while the workflow runs. If a workflow builder shares a credential across teams, everyone gets the same power. A single bad prompt or broken loop can run a heavy or destructive query.

Ephemeral Credentials + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Database table grants are also hard to keep tight as workflows grow over time. One workflow may only need to read order status from a customer table. Another workflow in the same space might need to update shipping rows. Teams often take a shortcut and give one database user full read-write rights.

That single user can also read every column inside the allowed tables by default. When an AI agent runs a query, the database returns all matching columns. Sensitive fields like emails, phone numbers, card numbers, and national IDs flow right back. Native database roles do not rewrite matched fields in results before the model reads them.

Best practices for scoping MariaDB roles in n8n

Start by creating separate MariaDB users for read-only tasks and write tasks. Give your AI agent tool sub-node a role that only allows select statements. Never attach a root or admin database account to an automated workflow node. If an agent only needs three tables, grant select rights on those three tables alone.

You should also restrict which network hosts can log in with that MariaDB user. Lock the database account to the fixed IP address of your workflow server. Set query timeouts and row limits on the database user inside MariaDB. This stops a bad agent query from locking tables or draining server memory.

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 is an open-source proxy that runs as a sidecar for your MySQL. It reads plain queries, prepared statements, and cursors on the wire.

First, hoop.dev guardrails block banned actions before MySQL runs them. An AI Analyzer you configure can score intent, and hoop.dev data masking rewrites sensitive string columns in results. Every query and verdict goes to the resource audit trail. Find the open-source binary on GitHub.

Frequently asked questions

Does n8n have a separate node for MariaDB credentials?

Many workflows use the built-in MySQL credential type to log in to MariaDB servers. Both databases share the same network protocol, so the MySQL tool sub-node works directly.

How should I connect MariaDB to an n8n AI Agent node?

Attach a MySQL tool sub-node to a current AI Agent node in your workflow. In n8n 1.82.0 and later, all AI Agent nodes operate as a Tools Agent.

How can I protect sensitive columns when an AI agent queries MariaDB?

Give the database user access only to safe tables or narrow SQL views. To protect emails, phone numbers, or card numbers in results, apply data masking in flight.

The query runs. The emails stay hidden.