Home > Missing Answers > One liner to backup all MySQL databases

One liner to backup all MySQL databases


echo "show databases" \
| mysql --skip-column-names \
| grep -v -P '^(performance|information)_schema$' \
| awk '{ print "mysqldump --events --routines --triggers " $1 " | bzip2 > /var/backups/" $1 ".sql.bz2" }' \
| sh

Categories: Missing Answers Tags: