Created
October 24, 2017 22:12
-
-
Save jcefoli/036074428d77536d8c27e6ecb818bdca to your computer and use it in GitHub Desktop.
Backup and Restore all MariaDB/MySQL Databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Take GZipped Backup of all DBs, Stored Procs and Triggers (https://stackoverflow.com/a/38527022) | |
#Note, if you want to shrink ibdata1, Another article recommends skipping a few DBS (https://stackoverflow.com/a/3456885) | |
#Backup | |
mysqldump -u root --all-databases --events --ignore-table=mysql.event --extended-insert --add-drop-database --disable-keys --flush-privileges --quick --routines --triggers | gzip > "all_databases.gz" | |
#Restore | |
gunzip < all_databases.gz | mysql -u root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment