Created
May 21, 2018 11:28
-
-
Save luksi1/e60b4818d17554cfe5133ce8b16d6307 to your computer and use it in GitHub Desktop.
MySQL Docker commands
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
# Get MySQL CLI | |
docker exec -it <CONTAINER> sh -c 'mysql -u${MYSQL_USER} --password=${MYSQL_PASSWORD}' | |
# Run SQL script | |
cp my.sql /path/to/mysql/volume | |
docker exec <CONTAINER> sh -c 'mysql -u${MYSQL_USER} --password=${MYSQL_PASSWORD} $MYSQL_DATABASE < /var/lib/mysql/my.sql' | |
# Backup MySQL database | |
docker exec <CONTAINER> sh -c 'exec mysqldump -u${MYSQL_USER} --password=${MYSQL_PASSWORD} $MYSQL_DATABASE' > my.backup.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment