DB_TYPE=postgresdb DB_POSTGRESDB_DATABASE=n8n DB_POSTGRESDB_HOST=localhost DB_POSTGRESDB_USER=n8n DB_POSTGRESDB_PASSWORD=secret n8n start

Category: n8n & Workflow Automation

DB_TYPE=postgresdb DB_POSTGRESDB_DATABASE=n8n DB_POSTGRESDB_HOST=localhost DB_POSTGRESDB_USER=n8n DB_POSTGRESDB_PASSWORD=secret n8n start

Use PostgreSQL as the database

Switches n8n from its default SQLite file to a PostgreSQL database on localhost, with the database, user, and password given. Every DB_POSTGRESDB_* variable must match a real Postgres setup, and the database must exist before startup. Postgres is the recommended database for production and queue mode.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.