In a previous post I described how to set up a local WordPress dev server with an Adminer web app to control the Mysql database. I have been using that setup for quite some time now. Despite being very lightweight, I feel Adminer is very limited. In addition, I didn’t really get used to it. Therefore, I decided to switch back to phpMyAdmin. I have been using it for over 10 years, and it’s my default for all sites I develop.
Here is an updated version of the docker-compose.ymlfile if you want phpMyAdmin to be your default web app for managing your Mysql database in this setup:
version: '3.9'
services:
wp_mysql:
image: mysql:latest
container_name: wp_mysql_cont
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password
restart: on-failure
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: wp_db
MYSQL_USER: wp_db_user
MYSQL_PASSWORD: wp_db_user_pass
ports:
- "6033:3306"
volumes:
- wp_mysql_volume:/var/lib/mysql
wp_app:
image: wordpress:latest
environment:
WORDPRESS_DB_HOST: wp_mysql
WORDPRESS_DB_USER: wp_db_user
WORDPRESS_DB_PASSWORD: wp_db_user_pass
WORDPRESS_DB_NAME: wp_db
volumes:
# - wp_web_app_volume:/var/www/html
- ./wp-data:/var/www/html/
restart: on-failure
ports:
- 8081:80
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin_cont
environment:
- PMA_HOST=wp_mysql
- PMA_PORT=3306
# - PMA_ARBITRARY=1 uncomment if you want to enter the DB host manually
links:
- wp_mysql
restart: always
ports:
- 8082:80
volumes:
wp_mysql_volume:
Save the above file on your disk, and from within the command line, run the following command: docker-compose up (assuming you have already installed docker-compose and docker on your system). After that, you can head to the following URL http://localhost:8081/ to install WordPress and use it later on.
Using this URL http://localhost:8082/, you will be able to access phpMyAdmin to manage your Mysql databases. For logging in, use the same credentials specified in the docker-compose.yml file.

Leave a Reply