Ghost - Pesky Newsletters

Ghost - Pesky Newsletters
Ghost

So, you have rebuilt your servers or restored data and now you need to clean up the archived newsletters.

The following should be considered:

  • You cannot do this with Ghost Pro hosting to my knowledge
  • It is not supported by ghost.org and they don't recommend it.
  • However, if you self-host and decide to cloud host you might need to do this, or archive newsletters depending on the tier you choose.
  • Maintenance

🔑 Access Ghost DB via Portainer

Log into Portainer

  • Open your Portainer dashboard in the browser.
  • Navigate to the stack or service where Ghost is deployed.

Identify the Database Container

  • Ghost usually runs with a MySQL (or MariaDB) container alongside the Ghost app.
  • In Portainer, look for a container named something like ghost-db, mysql, or mariadb.

Open the Console

  • Select the database container.
  • Use the “Console” or “Exec Console” option in Portainer.
  • Choose /bin/bash or /bin/sh as the shell.

Back up the ghost database

mysqldump -u <db_user> -p <db_name> > ghost-backup.sql

Connect to MySQL inside the container

mysql -u <db_user> -p <db_name>;
  • Enter the password (stored in your stack’s environment variables or secrets).

Inspect the newsletters table

USE <db_name>;
SELECT id, name, status FROM newsletters WHERE status='archived';

Delete the archived newsletters themselves

DELETE FROM newsletters WHERE status='archived';

Verify the clean up

SELECT id, name, status FROM newsletters;

Optimize the database (optional}

  • Exit the MySQL but stay in bash
mysqlcheck -u <db_root> -p --auto-repair --optimize --all-databases

Exit and restart Ghost

  • Exit the console.
  • Restart the Ghost app container to ensure changes are reflected.

⚠️ Important Notes

  • Always backup the database before making changes.
  • Ghost migrations assume at least one newsletter exists — don’t delete the last one.
  • If you’re running multiple Ghost stacks, repeat the process per stack.

Tested and working

#enoughsaid