Skip to content

Restore

A backup is the dump and its completion record (see Storage).

  1. Download both, for example with aws s3 cp s3://<bucket>/<key> . or with sftp.

  2. Check the dump against the record:

    Terminal window
    echo "$(jq --raw-output .sha256 20261022T134500Z-<run id>.json) 20261022T134500Z-<run id>.dump" |
    sha256sum --check
  3. Restore it into a new database with the native client.

Terminal window
createdb --template=template0 app_restored
pg_restore --exit-on-error --dbname=app_restored 20261022T134500Z-<run id>.dump

The dump has no roles, tablespaces or other global objects. The roles that own objects or have grants in the dump must exist before the restore.

Terminal window
mysql --defaults-extra-file=restore.cnf --execute='CREATE DATABASE app_restored'
mysql --defaults-extra-file=restore.cnf app_restored <20261022T134500Z-<run id>.sql

restore.cnf is an option file with [client], host, user and password, readable only by you, so that no argument holds the password. The dump names no database, so it restores into the database that you give. It has no accounts or grants, and the accounts in its DEFINER clauses must exist. A dump from a replica restores its events disabled: see MySQL replica.