--- title: Database environment variables description: Set up and configure databases with environment variables for your self-hosted n8n instance. contentType: reference tags: - environment variables hide: - 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](/1-0-migration-checklist/#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](https://www.sqlite.org/lang_vacuum.html){: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. |