n8n-docs/docs/hosting/configuration/environment-variables/database.md
Iván Ovejero 156507e8f9
Switch default Postgres user from root to postgres (#2070)
* Switch default Postgres user from `root` to `postgres`

* catch the second mention of it

---------

Co-authored-by: Deborah Barnard <deborah@starfallprojects.co.uk>
2024-05-02 14:54:46 +02:00

2.2 KiB

title description contentType tags hide
Database environment variables Set up and configure databases with environment variables for your self-hosted n8n instance. reference
environment variables
toc
tags

Database environment variables

--8<-- "_snippets/self-hosting/file-based-configuration.md"

By default, n8n uses SQLite. n8n also supports PostgreSQL. n8n removed support for MySQL and MariaDB in v1.0.

This page outlines environment variables to configure your chosen database for your self-hosted n8n instance.

Variable Type Default Description
DB_TYPE
/_FILE
Enum string:
sqlite, postgresdb
sqlite The database to use.
DB_TABLE_PREFIX * - Prefix to use for table names.

PostgreSQL

Variable Type Default Description
DB_POSTGRESDB_DATABASE
/_FILE
String n8n The name of the PostgreSQL database.
DB_POSTGRESDB_HOST
/_FILE
String localhost The PostgreSQL host.
DB_POSTGRESDB_PORT
/_FILE
Number 5432 The PostgreSQL port.
DB_POSTGRESDB_USER
/_FILE
String postgres The PostgreSQL user.
DB_POSTGRESDB_PASSWORD
/_FILE
String - The PostgreSQL password.
DB_POSTGRESDB_SCHEMA
/_FILE
String public The PostgreSQL schema.
DB_POSTGRESDB_SSL_CA
/_FILE
String - The PostgreSQL SSL certificate authority.
DB_POSTGRESDB_SSL_CERT
/_FILE
String - The PostgreSQL SSL certificate.
DB_POSTGRESDB_SSL_KEY
/_FILE
String - The PostgreSQL SSL key.
DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED
/_FILE
Boolean true If n8n should reject unauthorized SSL connections (true) or not (false).

SQLite

Variable Type Default Description
DB_SQLITE_VACUUM_ON_STARTUP Boolean false Runs VACUUM{:target="_blank" .external-link} operation on startup to rebuild the database. Reduces file size and optimizes indexes. This is a long running blocking operation and increases start-up time.