Setting PHPMyAdmin for Containerized WordPress

Since we are using Mysql in making docker-compose.yml file for dockered WordPress installation , we can add the service phpMyAdmin to access and view the database.

Open and edit the docker-compose.yml file and include the following phpMyAdmin service and its environs in your YAML file.

$ sudo nano docker-compose.yml

Add the following phpMyAdmin service and its environs:

phpmyadmin:
    depends_on:
      - my_database
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - '8080:80'
    environment:
      PMA_HOST: my_database
      MYSQL_ROOT_PASSWORD: my_password_1234789

Run the docker container:

 $ docker-compose up -d, 

Then open localhost:8000 to view the website

http://localhost:8000/

Open localhost:8080 to view the phpMyAdmin.

http://localhost:8080/

Enter your authentication details and you’ll be able to view and interact with the MySQL database.

Leave a Comment

Your email address will not be published. Required fields are marked *