summaryrefslogtreecommitdiffstats
path: root/create-mysql-dumps
blob: 2bec29caea17989956c5e7fa8de735d83d104467 (plain)
1
2
3
4
5
6
7
8
9
10
#!/bin/bash

mysql_opts="--defaults-file=/root/backup/mysql-defaults-backup"
backupdir="/root/backup/mysql-dumps/"

for db in $(mysql $mysql_opts -e 'show databases' -s --skip-column-names); do
        if [[ $db != "information_schema" && $db != "performance_schema" ]]; then
                mysqldump $mysql_opts "$db" --quick --create-options --disable-keys --add-locks --add-drop-table --lock-tables --complete-insert --skip-extended-insert | gzip > "$backupdir/$db.sql.gz"
        fi
done