mysql-bkup is configured with environment variables, CLI flags and an optional YAML file. For every setting the order is: flag, environment variable, deprecated name, YAML env: section, default. Every secret (DB_PASSWORD, AWS_SECRET_KEY, GPG_PASSPHRASE, …) can also be read from a file with <NAME>_FILE.
Run mysql-bkup config to see the resolved configuration and where each value comes from (secrets redacted).
Commands
Command
Description
backup
Back up now, or as a daemon with --cron-expression
restore
Restore a backup: -f FILE [-d DB]
migrate
Copy a database (or every database with -a) into TARGET_DB_*, streamed
verify
Download, decrypt and decompress a backup and check its sha256
list
Backup history from the index (--json, --storage-scan)
delete
Delete a backup, its sidecar and its index entry (-f FILE)
prune
Apply the retention policy (--dry-run)
reconcile
Rebuild the backup index (--from-index OLD, --dry-run)
config
Show the resolved configuration; --env-docs prints the tables below
health
Exit 0 when the daemon is healthy (Docker HEALTHCHECK)
Database host (a path starting with / is a Unix socket)
DB_PORT
3306
Database port
DB_NAME
--dbname-d
Database name
DB_USER
DB_USERNAME
Database user
DB_PASSWORD
DB_PASSWORD_FILE
Database password
DB_SSL_MODE
disabled
TLS mode: disabled, preferred, required, verify_ca, verify_identity (1.x values 0 and 1 mean disabled and required)
DB_SSL_CA
/etc/ssl/certs/ca-certificates.crt
CA certificate file, used with DB_SSL_MODE=verify_ca or verify_identity
DB_SSL_CERT
Client certificate file
DB_SSL_KEY
Client key file
BACKUP_ALL_DATABASES
--all-databases-a
Back up every database, one file each
BACKUP_ALL_IN_ONE
--all-in-one-A
Back up every database into a single file
BACKUP_EXCLUDE_DATABASES
--exclude-db
Databases to skip with –all-databases, comma separated
TARGET_DB_URL
TARGET_DB_URL_FILE
migrate: target connection URL
TARGET_DB_HOST
migrate: target host
TARGET_DB_PORT
3306
migrate: target port
TARGET_DB_NAME
migrate: target database (default: the source name)
TARGET_DB_USER
TARGET_DB_USERNAME
migrate: target user
TARGET_DB_PASSWORD
TARGET_DB_PASSWORD_FILE
migrate: target password
TARGET_DB_SSL_MODE
disabled
migrate: target TLS mode (same values as DB_SSL_MODE)
TARGET_DB_SSL_CA
/etc/ssl/certs/ca-certificates.crt
migrate: target CA certificate file
MYSQL_CLIENT
auto
Client tools: auto (mariadb-dump for MariaDB, Oracle mysqldump for MySQL), mysql or mariadb (auto, mysql, mariadb)
RESTORE_NO_DEFINER
auto
Remove DEFINER clauses on restore (views, triggers, routines and events then belong to the restoring user); auto = when that user lacks SET_USER_ID/SUPER (auto, true, false)
Scheduled Backups
Running in Scheduled Mode
Docker: Use the --cron-expression flag or the BACKUP_CRON_EXPRESSION environment variable to schedule backups.
Kubernetes: Use a CronJob resource for scheduled backups.
Cron Syntax
The cron syntax consists of five fields (a sixth, leading seconds field is also accepted):
* * * * * command
Field
Description
Values
Minute
Minute of the hour
0-59
Hour
Hour of the day
0-23
Day of Month
Day of the month
1-31
Month
Month of the year
1-12
Day of Week
Day of the week (0 = Sunday)
0-7
Examples
Every 30 minutes: */30 * * * *
Every hour at minute 0: 0 * * * *
Every day at 1:00 AM: 0 1 * * *
Predefined Schedules
Entry
Description
Equivalent To
@yearly (or @annually)
Run once a year, midnight, Jan. 1st
0 0 1 1 *
@monthly
Run once a month, midnight, first of month
0 0 1 * *
@weekly
Run once a week, midnight between Sat/Sun
0 0 * * 0
@daily (or @midnight)
Run once a day, midnight
0 0 * * *
@hourly
Run once an hour, beginning of hour
0 * * * *
Intervals
You can also schedule backups at fixed intervals using the format:
@every <duration>
Example: @every 1h30m10s runs the backup every 1 hour, 30 minutes, and 10 seconds.