Restic: Direct MariaDB/MySQL backup without intermediary file
This script assumes that .env
contains the MARIADB_ROOT_PASSWORD
variable to access MariaDB.
You need to set the RESTIC
environment variables appropriately so Restic knows where to backup to.
export RESTIC_REPOSITORY=rest:http://restic:[email protected]:16383/myservice
export RESTIC_PASSWORD_FILE=.restic_password
with .restic_password
containing just the encryption password for this specific share.
Backing up a local MariaDB/MySQL database directly to Restic
source .env # for MARIADB_ROOT_PASSWORD
mysqldump -uroot -p${MARIADB_ROOT_PASSWORD} --all-databases | restic --verbose backup --stdin --stdin-filename="mariadb.sql"
Backing up a dockerized MariaDB/MySQL database directly to Restic
source .env # for MARIADB_ROOT_PASSWORD
docker-compose exec -T mariadb mariadb-dump -uroot -p${MARIADB_ROOT_PASSWORD} --all-databases | restic --verbose backup --stdin --stdin-filename="mariadb.sql"