Last active
November 25, 2020 15:14
-
-
Save TravisBernard/97ddb82e56c8189d0a275cff9862a6ab to your computer and use it in GitHub Desktop.
Backup and Restore Docker Based Mysql
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
# Backs up the data from a docker mysql instance to the host machine's file system | |
docker-compose exec $MACHINEID mysqldump -uuser -ppass --all-databases > /host/machine/path/backup.sql | |
# Or | |
docker exec $MACHINEID mysqldump -uuser -ppass --all-databases > /host/machine/path/backup.sql |
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
# Restores a docker based mysql from a backup file on the host machine's file system | |
docker-compose exec -T $MACHINEID mysql -uuser -ppass < /host/machine/path/backup.sql | |
# Or | |
docker exec -i $MACHINEID mysql -uuser -ppass < /host/machine/path/backup.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment