[MySQL] Simplified mysql command

This commit is contained in:
Simon Cornet 2022-09-07 14:58:10 +02:00
parent 02d2ec5b9c
commit 86b074751c

View File

@ -9,9 +9,9 @@ retention=3
mkdir -p $backup_dir mkdir -p $backup_dir
# database backup # database backup
for DB in $(mysql -e 'show databases' -s --skip-column-names|grep -v 'information_schema\|performance_schema'); do for DB in $(mysql -e 'show databases' -sN|grep -v 'information_schema\|performance_schema'); do
mysqldump $DB > "$backup_dir/$date.$DB.sql"; mysqldump $DB > "$backup_dir/$date.$DB.sql";
done done
# delete old backups # delete old backups
find $backup_dir -type f -mtime +$retention -name '*.sql' -execdir rm -- '{}' \; find $backup_dir -type f -mtime +$retention -name '*.sql' -execdir rm -- '{}' \;