Skip to content

Instantly share code, notes, and snippets.

@n1mh
Last active February 28, 2018 22:15
Show Gist options
  • Save n1mh/ed4773298cd79d33e14d33218b35d1e5 to your computer and use it in GitHub Desktop.
Save n1mh/ed4773298cd79d33e14d33218b35d1e5 to your computer and use it in GitHub Desktop.
mysql/mariadb complete backup
#!/bin/bash
OUT="`date +%Y%m%d%H%M%S`-backup-`hostname -f`.sql"
mysqldump -u root -p \
--all-databases \
--routines \
--events \
--triggers \
--single-transaction \
--result-file=$OUT
bzip2 $OUT
echo "complete backup has been generated in $OUT.bz2 file"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment