Created
October 7, 2018 04:08
-
-
Save huanpc/c43e84a8a1d7d800911264d3a655de97 to your computer and use it in GitHub Desktop.
mysql backup by docker
This file contains 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
# full backup and crompress | |
docker exec -it [mysql_container_name] mysqldump -u[user] -p[password] --all-databases --add-drop-database --add-drop-table | gzip > /mysql_backup/db_bk_$(date +%F).gz | |
# full mysql restore with dropping table before recreating | |
docker exec -it [mysql_container_name] mysql -u[user] -p[password] < gz -d -c /mysql_backup/db_bk_$(date +%F).gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment