From 94ce812453853b555e39c0a5e5e3fe8b649768c9 Mon Sep 17 00:00:00 2001 From: bas Date: Wed, 30 Dec 2020 10:00:32 +0100 Subject: [PATCH] 1.8 Added DBS_SKIP to prevent dumping certain databases 1.8 Added DBS_SKIP to prevent dumping certain databases --- backup_mysql.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backup_mysql.sh b/backup_mysql.sh index 6c950ae..2241fea 100755 --- a/backup_mysql.sh +++ b/backup_mysql.sh @@ -29,6 +29,7 @@ # # ############################################################################################## # # +# 2020/12/30 1.8 Added DBS_SKIP to prevent dumping certain databases # # 2020/02/27 1.7 Added username and password and set default retention to 1 day # # 2019/01/28 1.6 Fixed backups of databases with dash (-) in name # # 2019/01/21 1.5 Fixed creation of databases with dot (.) in name # @@ -109,7 +110,8 @@ if [[ -n ${MYSQL_PW} && "${MYSQL_PW}" != "" ]]; then MYSQL_OPTS="${MYSQL_OPTS} -p${MYSQL_PW}" fi # Get list of Databases except the pid file -DBS_LIST=$(mysql ${MYSQL_OPTS} -s -N -e "show databases;") +DBS_SKIP="'mysql','performance_schema','sys','information_schema'" +DBS_LIST=$(mysql ${MYSQL_OPTS} -s -N -e "SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN (${DBS_SKIP});") index=0 # Check if we can connect to the mysql server; otherwise die