How to Configure n8n MariaDB Prevent Delete
You set up an n8n mariadb prevent delete workflow by restricting database user permissions. You remove delete grants on the MariaDB account that your n8n node uses. Most teams start by sharing one broad database login across all their workflows. When an automated workflow or AI agent shares that login, bad queries can drop rows. How to set up n8n mariadb prevent delete in native tools In n8n, an AI Agent node links a chat model to one or more tools. The agent decides which tools to call to fi
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 prevent delete workflow by restricting database user permissions. You remove delete grants on the MariaDB account that your n8n node uses. Most teams start by sharing one broad database login across all their workflows. When an automated workflow or AI agent shares that login, bad queries can drop rows.
How to set up n8n mariadb prevent delete in native tools
In n8n, an AI Agent node links a chat model to one or more tools. The agent decides which tools to call to finish a task. You must attach at least one tool sub-node to an AI Agent node. From n8n 1.82.0 on, the agent type setting is deprecated. Every AI Agent node now works as a Tools Agent. Node version 1 is removed in n8n 3.0. For SQL Agent tasks, n8n recommends a MySQL or Postgres tool sub-node. MariaDB uses the MySQL wire protocol, so teams use the MySQL tool sub-node. Besides built-in nodes, n8n offers a Call n8n Workflow Tool and Custom Code Tool. It also provides an HTTP Request Tool and a registry of MCP servers.
To stop row removal at the database level, admins create a dedicated MariaDB user. They grant only select, insert, and update rights on specific tables. They withhold the delete and drop privileges from that database role. Next, they store those restricted credentials inside the n8n credential store. Every workflow that talks to MariaDB then logs in with that restricted account. If a workflow or agent tries to delete rows, MariaDB blocks the statement.
Why database roles alone leave gaps in automated workflows
Native MariaDB privileges work well when a workflow only needs one fixed permission set. They stop simple delete statements from running under that user account. Yet static database roles only check who logs in at the start. They do not inspect what individual statements do while in flight.
Many n8n workflows need to write data and clean up temporary staging records. If you give the n8n account delete rights for staging, it gains broad power. An AI agent converts natural language questions into SQL queries and runs them. If a prompt confuses the model, it might run a bad update statement. An update statement without a filter can overwrite an entire table with blank values. To the database, that update looks valid if the user has update rights. Also, database grants cannot mask sensitive fields like emails or phone numbers in results. Relying only on static account grants leaves live tables exposed to faulty logic.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Separating read and write paths inside n8n workflows
You can lower risk in n8n by splitting read and write database accounts. Create one read-only MariaDB user for your AI Agent tool sub-nodes. Create a second user that only has insert and update rights on target tables. Never give the agent node the credentials meant for writing data.
When the agent needs to change data, route that step through a separate workflow. Use the Call n8n Workflow Tool so the agent passes parameters, not raw SQL. The child workflow then runs a fixed query with safe values. This layout keeps the chat model from writing its own destructive SQL statements. Still, managing dozens of database logins across many workflows creates heavy work for teams. Admins must track which node holds which password and audit query logs by hand.
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
Can the deprecated n8n SQL Agent block delete statements on its own?
No, the old SQL Agent turns natural language into SQL queries and runs them. You must restrict the database user permissions or filter statements before they run.
Which n8n node should I use for MariaDB with an AI agent?
N8n docs say to attach a MySQL tool sub-node to a recent AI Agent node. MariaDB works with the MySQL tool sub-node for running agent queries.
Does revoking delete rights stop all data loss in MariaDB?
No, a user with update rights can still overwrite columns with null or bad values. You also need query inspection and field masking for card numbers or national IDs.
Related guides
In this post