#!/bin/bash -e set -e DATE6D=`date +%y%m%d` SQL_DATA=mariadb-alldata-$DATE6D.sql SQL_USERS=mariadb-allusers-$DATE6D.sql rm -fr $SQL_DATA $SQL_USERS || exit 1 # Needed for MariaDB 10.4.X or above: # cat << 'END' > $SQL_DATA || exit 1 DROP TABLE IF EXISTS `mysql`.`global_priv`; DROP VIEW IF EXISTS `mysql`.`user`; END mysqldump -uroot --all-databases >> $SQL_DATA || exit 1 for x in user db tables_priv columns_priv procs_priv do mysqldump -uroot mysql $x || exit 1 done > $SQL_USERS bzip2 -9 $SQL_DATA $SQL_USERS || exit 1 ls -l $SQL_DATA.bz2 $SQL_USERS.bz2