Andrés
•
7 July 2023
•
1 min
MariaDB is one of the most popular open source relational database management systems in the world, and on the other hand, PhpMyadmin is another great stable and also free software tool written in PHP that serves to manage both databases on a MySQL server and MariaDB.
And docker will be the tool that will help us to run these two services in an easy and fast way, with data persistence. So we will have an environment ready in a few minutes to continue working.
Installation of Docker is required. If you haven’t done so already, please follow the official guides provided here.
Create a folder in your project directory and inside it a docker-compose.yml
file with the following content:
services:
mysql:
image: mariadb:latest
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_USER: abc
MYSQL_PASSWORD: abc123
volumes:
- mysql:/var/lib/mysql
restart: unless-stopped
phpmyadmin:
image: phpmyadmin:latest
ports:
- 8080:80
environment:
PMA_HOST: mysql
PMA_USER: auser
PMA_PASSWORD: pass12345
restart: unless-stopped
volumes:
mysql:
Update: I removed the version property from the file because it is now deprecated. ref
Save the changes and then raise the containers with the following command:
docker compose up
If you want to leave the containers running in background don’t forget the -d
flag. You will be able to access PhpMyadmin in your browser at http://localhost:8080
.
And that’s it. Important: You can use whatever credentials you want as long as it is a local development environment and do not pretend to use this docker compose definition in a productive environment.
Like it? Share it!