Last active
April 11, 2026 14:19
-
-
Save mzaksana/602c66f7ce755bd962d377af8c220bbc to your computer and use it in GitHub Desktop.
Mysql Lab
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
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| container_name: mysql | |
| restart: unless-stopped | |
| environment: | |
| MYSQL_ROOT_PASSWORD: rootpass | |
| MYSQL_DATABASE: mydb | |
| MYSQL_USER: user | |
| MYSQL_PASSWORD: userpass | |
| ports: | |
| - "3306:3306" | |
| volumes: | |
| - mysql_data:/var/lib/mysql | |
| phpmyadmin: | |
| image: phpmyadmin:latest | |
| container_name: phpmyadmin | |
| restart: unless-stopped | |
| environment: | |
| PMA_HOST: mysql | |
| PMA_PORT: 3306 | |
| PMA_USER: root | |
| PMA_PASSWORD: rootpass | |
| ports: | |
| - "8080:80" | |
| depends_on: | |
| - mysql | |
| volumes: | |
| mysql_data: |
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
| #!/usr/bin/make | |
| .PHONY = all clean | |
| BASH := $(shell which bash) | |
| up: | |
| bash -c 'docker-compose -p mysql-server -f docker-compose.yml up -d --build' | |
| down: | |
| bash -c 'docker-compose -p mysql-server -f docker-compose.yml down' | |
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
| # create network | |
| docker network create mysql-net | |
| # run mysql | |
| docker run -d \ | |
| --name mysql \ | |
| --network mysql-net \ | |
| -e MYSQL_ROOT_PASSWORD=rootpass \ | |
| -e MYSQL_DATABASE=mydb \ | |
| -e MYSQL_USER=user \ | |
| -e MYSQL_PASSWORD=userpass \ | |
| -p 3306:3306 \ | |
| -v mysql_data:/var/lib/mysql \ | |
| mysql:8.0 | |
| # run phpmyadmin | |
| docker run -d \ | |
| --name phpmyadmin \ | |
| --network mysql-net \ | |
| -e PMA_HOST=mysql \ | |
| -e PMA_PORT=3306 \ | |
| -p 8080:80 \ | |
| phpmyadmin:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment