Switch Ghost Database from SQLite3 to MySQL8

MySQL 8 will be the required database in the next major release of Ghost

Switch Ghost Database from SQLite3 to MySQL8

CAUTION: this is for single-user only

Official announcement: MySQL 8 will be the required database in the next major release of Ghost.
I’m kinda lazy, and there are not too many viewers on my site, so I'm just using the default SQLite3 database. Now it’s time to take action.

The steps of database migration (on the same server) are as follows:

1. Export Ghost content JSON file

Ghost Admin Panel -> Settings -> Labs -> Export you content.

2. Stop the container

docker-compose down

3. Remove any existing database local volume

4. Modify YML file

…
    environment:
      database__client: mysql
…
…
  db:
    image: mysql:8.0
…

5. Up the container

docker-compose up -d

6. Config your Ghost site

Go to YourGhostSite.com/ghost, create the same Username/Password as your previous Ghost site.
Go to Settings -> Lab -> Import content -> Upload the JSON file you just downloaded -> Import

(Optional) 7. Tips

Always keep a copy of your content folder and regularly export JSON file as a backup.


Copyright statement: Unless otherwise stated, all articles on this blog adopt the CC BY-NC-SA 4.0 license agreement. For non-commercial reprints and citations, please indicate the author: Henry, and original article URL. For commercial reprints, please contact the author for authorization.