VPS Snaps
All guides

Database backups

Dump, restore and automate PostgreSQL, MySQL, MongoDB, Redis, SQLite, Elasticsearch, ClickHouse, InfluxDB, CouchDB, Neo4j, Qdrant and Meilisearch: on servers, replicas, Railway and Render, straight to S3, and to a point in time.

How to back up and restore PostgreSQL with pg_dump and pg_restore

Back up a PostgreSQL database with pg_dump, restore it with pg_restore or psql, check the dump is usable, and schedule it with cron.

9 min read · Tested

How to back up and restore MySQL and MariaDB with mysqldump

Make consistent mysqldump backups without locking InnoDB tables, keep the password off the command line, restore them, and check they work.

7 min read

How to back up and restore MongoDB with mongodump and mongorestore

Dump a MongoDB deployment to one compressed archive, restore all of it or one collection, verify the result, and know when mongodump is the wrong tool.

7 min read

How to back up and restore Redis (RDB and AOF)

Decide whether your Redis needs a backup, take RDB snapshots with BGSAVE or redis-cli --rdb, copy Redis 7's multi-part AOF safely, restore without Redis overwriting your file, verify it, and schedule it with cron.

9 min read · Tested

How to set up PostgreSQL point-in-time recovery with WAL archiving

Archive PostgreSQL's WAL safely, take base backups with pg_basebackup, and restore to a chosen second or a named restore point. Tested commands, a retention script and the errors you will meet.

12 min read · Tested

How to back up PostgreSQL roles, users and permissions

Back up PostgreSQL roles, password hashes, memberships and tablespaces with pg_dumpall --globals-only, restore them before your databases, and load them into a managed database where you are not a superuser.

8 min read · Tested

How to back up a managed database (DigitalOcean, AWS RDS)

What DigitalOcean and AWS RDS automatic backups cover and what they miss, and how to keep your own pg_dump and mysqldump copies of a managed database in storage you control.

9 min read

How to do point-in-time recovery for MySQL with binary logs

Keep MySQL binary logs, take dumps that record their binlog position, copy the logs off the server, and replay them with mysqlbinlog to just before a bad statement.

9 min read

How to back up a SQLite database safely

Copy a live SQLite database without corrupting it or losing recent writes: .backup, VACUUM INTO and .dump, how to check and restore the copy, and a cron script.

8 min read

How to back up a Railway Postgres database

Use Railway's volume backups for quick rollbacks, then keep your own pg_dump copies outside Railway: from your machine through the TCP proxy, or from a cron service on the private network. Restore into a new Postgres and test it.

10 min read

How to back up a Render PostgreSQL database

What Render's point-in-time recovery and exports cover, what is lost when a database is deleted, and how to keep your own pg_dump backups from a server or a Render cron job.

9 min read

How to take physical MySQL and MariaDB backups with XtraBackup

Hot physical backups of MySQL with Percona XtraBackup and of MariaDB with mariadb-backup: pick the right version, back up, prepare, restore, stream to S3 and add incremental backups.

10 min read

How to upgrade PostgreSQL to a new major version safely

Move a PostgreSQL cluster to a new major version, such as 17 to 18, with pg_upgradecluster, pg_upgrade or a dump and restore, with a tested backup, pre-flight checks and a way back.

10 min read

How to back up Elasticsearch or OpenSearch with snapshots

Register a snapshot repository, take snapshots by hand and on a schedule with Elasticsearch SLM or OpenSearch Snapshot Management, restore indices without overwriting live ones, and check version compatibility before you need it.

10 min read

How to import a SQL file into MySQL or MariaDB

Import .sql and .sql.gz dumps with the mysql client or SOURCE, watch progress on big files, speed up large loads safely, check the result, and fix the errors imports hit most.

11 min read

How to reset the MySQL or MariaDB root password

Get back into MySQL or MariaDB when the root password is lost: try socket login first, then reset it with an init file or --skip-grant-tables, under systemd, in Docker and on managed databases.

9 min read

How to repair corrupted MySQL tables

Check MySQL and MariaDB tables, repair MyISAM and Aria with REPAIR TABLE, mysqlcheck or myisamchk, rescue corrupted InnoDB with innodb_force_recovery, and know when to restore instead.

9 min read

How to back up MySQL from a replica

Set up a read-only GTID replica of MySQL 8.4 or MariaDB, take consistent mysqldump backups from it instead of the primary, and catch a stalled replica before it hands you stale backups.

10 min read

How to restore a PostgreSQL dump with pg_restore or psql

Find out which format a PostgreSQL dump is in, load plain SQL with psql and archives with pg_restore, restore part of a dump, check the result, and fix the errors restores print.

10 min read · Tested

PostgreSQL incremental backups with pg_basebackup

Take incremental physical backups on PostgreSQL 17 and newer: turn on WAL summaries, chain pg_basebackup --incremental onto a full backup, rebuild it with pg_combinebackup, verify it, and delete whole chains.

9 min read

How to back up a MongoDB replica set

Dump a MongoDB replica set without loading the primary, make the dump consistent with --oplog, add hidden and delayed members for backups, snapshot a member safely, size the oplog window, and restore into a new replica set.

9 min read

How to back up PostgreSQL, MySQL and MongoDB to S3 automatically

Stream a compressed PostgreSQL, MySQL or MongoDB dump straight into S3 or any S3-compatible bucket with the AWS CLI: a key that cannot delete, a cron script that catches failed dumps, lifecycle retention, restores and the exact errors.

12 min read

How to back up PostgreSQL with pgBackRest

Set up pgBackRest, the open-source PostgreSQL backup tool, with an encrypted S3 repository: WAL archiving, full, differential and incremental backups, retention, point-in-time restores and the errors it prints.

10 min read

How to back up ClickHouse

Back up ClickHouse with its built-in BACKUP and RESTORE commands to a local disk or S3, add incremental backups, include users and roles, run it on a schedule, restore under a new name, and fix the common errors.

9 min read

How to back up InfluxDB

Back up and restore InfluxDB 2 with influx backup and the operator token, InfluxDB 1.x with influxd backup -portable, and InfluxDB 3 Core and Enterprise, plus line protocol exports, a nightly script and the common errors.

8 min read

How to back up a Qdrant vector database

Back up self-hosted Qdrant with collection and full storage snapshots, download and verify them on a schedule, restore by upload, file or at startup, and know when re-embedding is the better backup.

8 min read

How to back up Meilisearch

Back up self-hosted Meilisearch with snapshots for fast recovery and dumps for upgrades: schedule them, wait on the task, keep dated copies off the server, restore on a new server and fix the common errors.

7 min read

How to back up Apache CouchDB

Back up CouchDB 3 by copying its append-only data files while it runs, views first, plus the config that holds admins, the secret and the node name; restore on a new server, use replication safely and fix the common errors.

9 min read

How to back up Neo4j

Back up Neo4j Community with neo4j-admin database dump while it is stopped, include the system database for users, check and load dumps, run it nightly, use Docker, move between versions and fix the common errors. Enterprise online backups too.

8 min read