mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2025-11-20 17:48:34 +00:00
2.5 KiB
2.5 KiB
| title | description | contentType | tags | hide | |||
|---|---|---|---|---|---|---|---|
| Database environment variables | Set up and configure databases with environment variables for your self-hosted n8n instance. | reference |
|
|
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_POOL_SIZE/ _FILE |
Number | 2 |
Control how many parallel open Postgres connections n8n should have. Increasing it may help with resource utilization, but too many connections may degrade performance. |
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. |