Last active
July 2, 2022 21:06
-
-
Save hasinhayder/b1467216c353f5032575b79b53ef0394 to your computer and use it in GitHub Desktop.
mariadb and phpmyadmin docker image
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
version: '3.1' | |
services: | |
mariadb: | |
image: mariadb:10.8 | |
restart: always | |
ports: | |
- 3306:3306 | |
volumes: | |
- ./mariadb:/var/lib/mysql | |
environment: | |
- MYSQL_ROOT_PASSWORD=root | |
- MYSQL_PASSWORD=admin | |
- MYSQL_USER=admin | |
- MYSQL_DATABASE=test | |
- MYSQL_TCP_PORT=3306 | |
phpMyAdmin: | |
image: phpmyadmin | |
restart: always | |
ports: | |
- 8080:80 | |
environment: | |
- PMA_ARBITRARY=1 |
you can also connect to this docker image from your terminal as
mysql -u root -p -h 127.0.0.1
or simply run docker ps
- you will see the image name as something like mariadb_mariadb_1
then you can log into the shell as
docker exec -it mariadb_mariadb_1 bash
if MariaDB is running on another port, for example 3307, you can configure phpMyAdmin to connect on port 3307 like this
version: '3.1'
services:
mariadb:
image: mariadb:10.8
restart: always
ports:
- 3307:3306
volumes:
- ./mariadb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_PASSWORD=admin
- MYSQL_USER=admin
- MYSQL_DATABASE=test
- MYSQL_TCP_PORT=3306
phpMyAdmin:
image: phpmyadmin
restart: always
ports:
- 8080:80
environment:
- PMA_PORT:3307
- PMA_ARBITRARY=1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
create a folder named
mariadb
in the same folder wheredocker-compose.yml
isthis will act as your data directory
you can access phpmyadmin in browser as
http://localhost:8080
default server name = mariadb
user: admin
password: admin