Backing Up Your Plainpad Database

Backing Up Your Plainpad Database

Self-hosting gives you full control of your notes. It also gives you full responsibility for them. If the disk dies and there is no backup, nobody else has a copy.

The good news: Plainpad stores everything in one MySQL/MariaDB database and a handful of files. A complete backup is two commands.

What actually needs backing up

That second one deserves emphasis. If database encryption is enabled and you lose the key, the dump is a pile of ciphertext. Back up the config with the database, and store them somewhere you can still reach when the server is gone.

The dump

mysqldump --single-transaction --quick \
  -u plainpad -p plainpad \
  | gzip > /var/backups/plainpad-$(date +%F).sql.gz

--single-transaction takes a consistent snapshot without locking the tables, so the app keeps working while the dump runs. --quick streams rows instead of buffering the whole table in memory, which matters on a small VPS.

On a schedule

Put the credentials in ~/.my.cnf so they stay out of the crontab and out of ps:

[client]
user=plainpad
password=your-password
chmod 600 ~/.my.cnf

Then a daily job at 03:30, keeping 30 days:

30 3 * * * mysqldump --single-transaction --quick plainpad | gzip > /var/backups/plainpad-$(date +\%F).sql.gz && find /var/backups -name 'plainpad-*.sql.gz' -mtime +30 -delete

Note the escaped \% - cron treats a bare % as a newline and the job will fail in a way that is genuinely confusing the first time.

Off the machine

A backup on the same disk as the database is not a backup. Copy it somewhere else - another host, object storage, an external drive:

rsync -az /var/backups/ backup-host:/srv/backups/plainpad/

Test the restore

This is the step everybody skips, and it is the only step that proves the rest worked.

mysql -e 'CREATE DATABASE plainpad_restore_test'
gunzip -c /var/backups/plainpad-2026-09-28.sql.gz | mysql plainpad_restore_test
mysql plainpad_restore_test -e 'SELECT COUNT(*) FROM notes'

If the count looks right, you have a backup. If the import throws an error, you have a file. Do this once now, and once every few months after.

A realistic minimum

If you do nothing else: one daily dump, one copy off the machine, one restore test a year. That is more discipline than most hosted services apply to your data on your behalf.

Services

Want a hand with Plainpad?

We can host it for you, help you fix a problem, put your brand on it, build something new or move your notes over.

See our services