Created
February 10, 2022 09:45
-
-
Save stefanopascazi/4fb630148d3bdf83de721d02ad3dbc21 to your computer and use it in GitHub Desktop.
Dump Or Restore MySQL from a container
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
#!/bin/bash | |
## mysqldump | |
docker exec -i CONTAINER_NAME /usr/bin/mysqldump -u DB_USER -p'DB_PASS' DB_NAME > dump.sql | |
## Restore | |
cat dump.sql | docker exec -i CONTAINER_NAME /usr/bin/mysql -u DB_USER -p'DB_PASS' DB_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment