- forked from YoSiJo/run-mariabackup
- forked from omegazeng/run-mariabackup
- forked from jmfederico/run-xtrabackup.sh
- forked from omegazeng/run-mariabackup
Note: I have tested this on openSUSE Tumbleweed 20230512 with MariaDB 10.11.2.
This new fork (as of 2023-05-15) has seen only very limited testing and use. In particular, only with MyISAM and InnoDB tables. In these limited cases, it worked fine but there is no guarantee at all that it will fulfill any purpose in your specific environment. As it is acting on complete database server setups with possibly many databases and complexities which I have never seen before, there is a high probability that this script will break in your scenario and can possibly have catastrophic effects. Just as a non-exclusive single example, I have not tried it on databases with stored procedures or triggers.
So, use these scripts only after your own educated review and on your own risk!
Also, please share any concerns and observations, most preferred of course, in the form of pull-requests or bug reports.
This fork is a thorough rewrite of the above mentioned precursors. It contains various fixes and extensions, in particular single-database restore.
Full Backup and Restore with Mariabackup
Incremental Backup and Restore with Mariabackup
Individual Database Restores with MariaBackup from Full backup
sudo apt install mariadb-backup
-- See https://mariadb.com/kb/en/mariabackup-overview/#authentication-and-privileges
CREATE USER 'backup'@'localhost' IDENTIFIED BY 'YourPassword';
-- MariaDB < 10.5:
GRANT RELOAD, PROCESS, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup'@'localhost';
-- MariaDB >= 10.5:
GRANT RELOAD, PROCESS, LOCK TABLES, BINLOG MONITOR ON *.* TO 'backup'@'localhost';
FLUSH PRIVILEGES;
Edit config.sh
to match your needs and environment.
MYSQL_PASSWORD=YourPassword bash run-mariabackup/backup.sh
You can place a file called base-backup.request
into ${BACKUP_PATH}
in order to request a base
(non-incremental) backup (e.g. using a weekly cron-job on Sunday night).
For an all-database restore, go to the directory with your intended backup state,
i.e. ${BACKUP_PATH}/base/yyyy-mm-dd_HH-MM-SS
or ${BACKUP_PATH}/incr/yyyy-mm-dd_HH-MM-SS/yyyy-mm-dd_HH-MM-SS
and run:
MYSQL_PASSWORD=YourPassword bash run-mariabackup/restore.sh
For a single-database restore:
MYSQL_PASSWORD=YourPassword bash run-mariabackup/restore.sh <src-database> <dst-database>
#MySQL Backup
30 2 * * * MYSQL_PASSWORD=YourPassword bash /data/run-mariabackup/backup.sh &> /var/log/mariabackup.log