DEV Community 👩‍💻👨‍💻

Kiran
Kiran

Posted on • Updated on • Originally published at kirandev.com

MySQL + phpMyAdmin Docker Compose

Here is a simple docker-compose file to run MySQL + phpMyAdmin services for your development needs.

Create a file docker-compose.yml.

Copy and paste the below code.

Run it using the command docker-compose up.

version: "3"

services:
  # Database
  db:
    platform: linux/x86_64
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: yourdb
      MYSQL_PASSWORD: password
    networks:
      - mysql-phpmyadmin

  # phpmyadmin
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin
    restart: always
    ports:
      - "8090:80"
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: password
    networks:
      - mysql-phpmyadmin

networks:
  mysql-phpmyadmin:

volumes:
  db_data:
Enter fullscreen mode Exit fullscreen mode

You can access the phpMyAdmin at http://localhost:8090/

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.