Files
n8n-docs/docs/hosting/configuration/supported-databases-settings.md
krisn0x 0b0ecf59f5 Update PostgresDB support information (#4116)
Co-authored-by: Kartik Balasubramanian <22399046+HumanistSerif@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-01-17 11:44:26 +00:00

2.8 KiB

contentType
contentType
reference

Supported databases

By default, n8n uses SQLite to save credentials, past executions, and workflows. n8n also supports PostgresDB (only actively maintained versions).

Database type by n8n installation

The database type used varies depending on your n8n installation:

Self-hosted n8n

By default, self-hosted installations use SQLite. You can optionally configure PostgreSQL by setting the appropriate environment variables (see PostgresDB configuration).

n8n Cloud

n8n Cloud installations use different databases depending on your plan tier:

  • SQLite: Trial, Starter, and Pro plans, as well as legacy Enterprise plans
  • PostgreSQL: Enterprise Scaling plans only

Shared settings

The following environment variables get used by all databases:

  • DB_TABLE_PREFIX (default: -) - Prefix for table names

PostgresDB

To use PostgresDB as the database, you can provide the following environment variables:

  • DB_TYPE=postgresdb
  • DB_POSTGRESDB_DATABASE (default: 'n8n')
  • DB_POSTGRESDB_HOST (default: 'localhost')
  • DB_POSTGRESDB_PORT (default: 5432)
  • DB_POSTGRESDB_USER (default: 'postgres')
  • DB_POSTGRESDB_PASSWORD (default: empty)
  • DB_POSTGRESDB_SCHEMA (default: 'public')
  • DB_POSTGRESDB_SSL_CA (default: undefined): Path to the server's CA certificate used to validate the connection (opportunistic encryption isn't supported)
  • DB_POSTGRESDB_SSL_CERT (default: undefined): Path to the client's TLS certificate
  • DB_POSTGRESDB_SSL_KEY (default: undefined): Path to the client's private key corresponding to the certificate
  • DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED (default: true): If TLS connections that fail validation should be rejected
export DB_TYPE=postgresdb
export DB_POSTGRESDB_DATABASE=n8n
export DB_POSTGRESDB_HOST=postgresdb
export DB_POSTGRESDB_PORT=5432
export DB_POSTGRESDB_USER=n8n
export DB_POSTGRESDB_PASSWORD=n8n
export DB_POSTGRESDB_SCHEMA=n8n

# optional:
export DB_POSTGRESDB_SSL_CA=$(pwd)/ca.crt
export DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=false

n8n start

Required permissions

n8n needs to create and modify the schemas of the tables it uses.

Recommended permissions:

CREATE DATABASE n8n-db;
CREATE USER n8n-user WITH PASSWORD 'random-password';
GRANT ALL PRIVILEGES ON DATABASE n8n-db TO n8n-user;

TLS

You can choose between these configurations:

  • Not declaring (default): Connect with SSL=off
  • Declaring only the CA and unauthorized flag: Connect with SSL=on and verify the server's signature
  • Declaring _{CERT,KEY} and the above: Use the certificate and key for client TLS authentication

SQLite

This is the default database that gets used if nothing is defined.

The database file is located at: ~/.n8n/database.sqlite