Database Configuration
Forge supports using SQLite (default), PostgreSQL, or MySQL/MariaDB for its database backend. You can control which database is used by setting the FORGE_DB_CONNECTION environment variable.
- SQLite (default):
- If
FORGE_DB_CONNECTIONis not set, Forge will use a local SQLite database file (Forge.sqlite).
- If
- PostgreSQL:
- Set
FORGE_DB_CONNECTIONto a valid PostgreSQL connection string (e.g.,Host=localhost;Port=5432;Database=forge;Username=forge;Password=yourpassword).
- Set
- MySQL/MariaDB:
- Set
FORGE_DB_CONNECTIONto a valid MySQL/MariaDB connection string (e.g.,Server=localhost;Port=3306;Database=forge;Uid=forge;Pwd=yourpassword).
- Set
You can explicitly specify the provider in your connection string using Provider=postgres, Provider=mysql, or Provider=mariadb. If Provider is not set, Forge will auto-detect the database type based on keywords:
- Provider=postgres or Provider=postgresql: Use PostgreSQL
- Provider=mysql or Provider=mariadb: Use MySQL/MariaDB
- Otherwise, keyword-based detection is used:
- If the string contains typical PostgreSQL keywords (Host/Server and Username/User Id), PostgreSQL is used (port can be any value).
- If the string contains typical MySQL/MariaDB keywords (Host/Server and Uid/User Id/Username), MySQL/MariaDB is used (port can be any value).
- Otherwise, SQLite is used.
Examples
PostgreSQL
FORGE_DB_CONNECTION="Host=localhost;Port=5432;Database=forge;Username=forge;Password=yourpassword"
MySQL/MariaDB
FORGE_DB_CONNECTION="Server=localhost;Port=3306;Database=forge;Uid=forge;Pwd=yourpassword"
Notes
- If you switch between database types, you must manually migrate your data.
- Ensure the target database server is running and accessible from the Forge host.