-
-
Save WebSofter/47d4d18e150a290a3fce1afa40ac8b0f to your computer and use it in GitHub Desktop.
Snippet for MySQL database in docker-compose
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
APP_TAG=doska | |
MYSQL_ROOT_PASSWORD=secret | |
MYSQL_DB=doska | |
MYSQL_USER=doska | |
MYSQL_PASSWORD=secret |
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
version: '3.3' | |
services: | |
doska_mysql: | |
image: mariadb | |
container_name: doska_mysql | |
volumes: | |
- ./docker/mysql:/var/lib/mysql | |
env_file: .env | |
environment: | |
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD | |
MYSQL_DATABASE: $MYSQL_DB | |
MYSQL_USER: $MYSQL_USER | |
MYSQL_PASSWORD: $MYSQL_PASSWORD | |
#MYSQL_ROOT_HOST: '%' #For external access. Uncommet, if you need | |
restart: always | |
ports: | |
- '3306:3306' | |
networks: | |
- doska-network | |
volumes: | |
doska_mysql: | |
driver: local | |
networks: | |
doska-network: | |
driver: bridge |
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
For Connect | |
Server=doska.kupeyka.com;Database=doska;User ID=root;Password=secret;Trusted_Connection=True;MultipleActiveResultSets=true | |
For Import dump | |
docker exec -i some-mysql sh -c 'exec mysql -u<user> -p<password> <database>' < /some/path/on/your/host/all-databases.sql | |
For export dump | |
docker exec some-mysql sh -c 'exec mysqldump --all-databases -u<user> -p<password> <database>' > /some/path/on/your/host/all-databases.sql | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment