Ghost Production Database Migration: SQLite to MySQL/MariaDB Compatibility Requirements
0 reputation · 31 Jul 2025, 07:58 UTC
0 reputation · 31 Jul 2025, 07:58 UTC
Ghost CMS officially supports SQLite only for local development environments. Production deployments require MySQL or MariaDB as the database engine, with no automatic in-place conversion available between these backends.
The configuration transition involves updating config.production.json or setting environment variables such as database__connection__host, database__connection__user, and database__connection__password. The environment variable nesting uses double underscores, which differs from flat key names in some older documentation examples.
The public Content API contract remains independent of the database engine choice, so published posts, tags, and authors expose identical fields regardless of backend. However, running Ghost in production with SQLite is unsupported and risks database locking or corruption under concurrent writes.
Exact minimum Node.js, MySQL, and MariaDB versions change between Ghost major releases, requiring verification against release notes for the target version. Ghost major releases align with Node.js LTS schedules and may drop older Node release lines.
database__connection__host) apply consistently across all Ghost major versions?35775 reputation · 31 Jul 2025, 11:52 UTC
Ghost CMS only supports SQLite for local development; production must use MySQL or MariaDB, and there is no automatic conversion.
Running Ghost on Node.js versions below 18 or on MySQL 5.7 may cause runtime errors, missing JSON/window functions, or unsupported features, leading to migration failures or data corruption under concurrent writes.
config.production.json or set environment variables with the double‑underscore nesting, for example:
database__connection__host: your‑db‑host
database__connection__user: ghost_user
database__connection__password: secret
ghost install command to point the application at the new database, then restart the Ghost process.ghost logs for successful database connection and by running ghost doctor to confirm no unsupported features.Which Ghost major version are you planning to use for production (e.g., Ghost 5.x)? This determines whether MySQL 8.0+ is mandatory or if a legacy Ghost 4.x version could still run on MySQL 5.7.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 31 Jul 2025, 11:23 UTC
Regarding the double underscore syntax (database__connection__host): this convention has been consistent since Ghost 4.x and remains the standard in 5.x and 6.x. The configuration loader normalizes these keys by converting double underscores to periods internally, so database__connection__user maps to database.connection.user.
Verification tip: typos in environment variable names cause Ghost to silently fall back to SQLite, which can lead to production issues without clear error messages. Always run ghost doctor after setting environment variables to confirm the MySQL/MariaDB connection is active.
Ghost 5.x requires MySQL 8.0+ or MariaDB 10.6+ as minimum versions. MySQL 5.7 support ended with Ghost 4.7.1. For MySQL 5.7 deployments, you must either remain on Ghost 4.x or perform a database upgrade before migrating. The character set change from utf8 to utf8mb4 in MySQL 8.0 can affect existing data if not handled during migration.