With the release of Ghost 5.0 back in May 2022, one of the biggest architectural changes was the announcement that MySQL 8 would be the only database officially supported in production environments. While committing to a full-blown database like MySQL might be a sensible and easy-to-make decision for a larger company or business, for those of us who primarily use Ghost as a hobbyist or small-business/side-gig static blogging platform (ditto on those new Ghost features like paid subscriptions and native commenting), SQLite has been working fine for years. It's easy (no need to configure and maintain a giant MySQL installation), it's still highly performant, and best of all, it's easily backed up - all I need to do is
cp -R my
ghost directory. And specifically for those of us who like to make life even easier with Docker, the official Docker Ghost image has also shipped with SQLite as the default database for years....until it didn't.
Somewhere in the vicinity of the Docker image release for Ghost 5.9, the default database was switched to MySQL. Not a terribly unreasonable idea given that the production default for Ghost 5.x is MySQL, but unfortunately this change broke a lot of people's existing Ghost-on-Docker instances that used the old default sqlite3 setup, as evidenced by the numerous subsequent complaints.
Thankfully, the fix for this is relatively easy, assuming you want to keep using SQLite. Stop and remove your existing Ghost container, then recreate it with the following environment variables:
-e database__client=sqlite3 \ -e database__connection__filename="content/data/ghost.db" \ -e database__useNullAsDefault=true \ -e database__debug=false \
This is consistent with Ghost's officially recommended configuration settings for sqlite3. Assuming that the path to your
ghost.db is correct, your Ghost instance should be back up and running shortly!
It bears repeating that running Ghost on SQLite in production is officially unsupported, and that this could stop working at any time if future versions of Ghost implement new features or breaking changes that simply won't work with SQLite any more. Indeed, you'll be reminded of this every time you visit the admin panel. However, as Ghost uses knex.js as a database abstraction layer, hopefully this won't happen anytime soon!