How to Configure n8n CockroachDB Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up n8n cockroachdb credentials by saving a Postgres-compatible database login in your workflow tool. Then you attach that login to a standard node or an AI agent tool sub-node. Teams often start by reusing an admin account so workflows run right away. That broad role lets every automated step or AI agent read and change any table. How n8n cockroachdb credentials work in workflows CockroachDB speaks the standard Postgres wire protocol for client logins. In n8n, you store the host, port

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 cockroachdb credentials by saving a Postgres-compatible database login in your workflow tool. Then you attach that login to a standard node or an AI agent tool sub-node. Teams often start by reusing an admin account so workflows run right away. That broad role lets every automated step or AI agent read and change any table.

How n8n cockroachdb credentials work in workflows

CockroachDB speaks the standard Postgres wire protocol for client logins. In n8n, you store the host, port, database name, user, and password as one credential item. You also turn on TLS settings so the link between the app and cluster stays encrypted. Once saved, any workflow node with permission to use that item can open a database session.

This setup also applies when you build AI workflows in n8n. The n8n AI Agent node pairs a chat model with one or more tool sub-nodes. The agent decides which tools to call to complete a task. You must attach at least one tool sub-node to an AI Agent node.

In n8n 1.82.0, the older agent type setting was deprecated. All AI Agent nodes now work as a Tools Agent, and version 1 leaves in n8n 3.0. For SQL tasks, the docs say to attach a Postgres tool sub-node to a recent Agent node. That tool sub-node uses your stored database login whenever the model decides to run a query.

Create a scoped database role first

Before you save the login in n8n, create a dedicated user inside your CockroachDB cluster. Do not share a root or admin user across your automation jobs. Grant the new role permission to read or write only the tables that the workflow needs. If an AI agent only answers questions, give its database role read-only rights on safe tables.

You can also limit which schemas the role can inspect. When a workflow runs, CockroachDB checks the role permissions at login and before each query. If a node tries to drop a table without rights, the database blocks the action. Scoping the role is the fastest way to shrink your blast radius.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native credentials solve and what they miss

Static logins and database roles solve the problem of who can log into the cluster. They make sure an unauthorized app cannot open a session or touch restricted tables. They also help database admins separate workflow traffic from human traffic in cluster logs. For simple, fixed queries, a scoped role is a good first step.

Still, a database login only checks permissions at the table or view level. Once a workflow or AI agent logs in, it can read every row in an allowed table. If that table holds customer emails, phone numbers, or card numbers, the query returns all of them. Native roles cannot rewrite matched fields in results before the data reaches the workflow or model.

Shared workflow logins also hide which specific user or trigger started a bad query. In the database log, every statement comes from the same n8n service account. And if an AI agent writes a slow or destructive query inside an allowed table, the role allows it. Teams need a way to inspect queries and mask sensitive fields in flight.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Which node should I use for n8n cockroachdb credentials?

CockroachDB uses the Postgres wire protocol, so you use the built-in Postgres credential type and nodes. For AI workflows, attach a Postgres tool sub-node to the AI Agent node.

Should I use the n8n SQL Agent for CockroachDB queries?

No, n8n deprecated the standalone SQL Agent setting starting in version 1.82.0. The official docs recommend using a recent AI Agent node with a Postgres tool sub-node instead.

Why is a read-only database role not enough for AI agents?

A read-only role stops writes, but it still lets the agent read every column in allowed tables by default. Without field-level masking, queries can pull raw emails, phone numbers, and card numbers into model prompts.

The query runs. The emails stay hidden.