Created
April 22, 2022 09:38
-
-
Save mipmip/048df12ad2f6c22ba6e8db4ee6eb005e to your computer and use it in GitHub Desktop.
docker-mysq-exec-on-liner
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
export $(cat .env | xargs) && docker-compose exec -T mysql mysql -p$MYSQL_PASS <<< "show databases\G" |
also handy for importing and exporting:
# EXPORT
export $(cat .env | xargs) && docker-compose exec -T mysql mysqldump -uroot -p$MYSQL_PASS \
--skip-comments --databases powerdns powerdnsadmin > /tmp/powerdnsdump.sql
# IMPORT
export $(cat .env | xargs) && docker-compose exec -T mysql mysql -p$MYSQL_PASS < /tmp/powerdnsdump.sql
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
reads .env for password and forward command into the mysql that run inside a docker container