This a simple docker-compose file.yml file to help speed up development with a MySQL server, connection details and phpMyAdmin interface:

YAML
version: '3'

services:
  mariadb:
    image: mariadb:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example_root_password
      MYSQL_DATABASE: example_database
      MYSQL_USER: example_user
      MYSQL_PASSWORD: example_password
    ports:
      - "3306:3306"
    volumes:
      - ./data:/var/lib/mysql

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: always
    environment:
      PMA_HOST: mariadb
      PMA_USER: example_user
      PMA_PASSWORD: example_password
    ports:
      - "8080:80"
    depends_on:
      - mariadb

Note: You’ll need Docker Desktop app from the official Docker website to run this file.

Run the following command in this directory to open the database and PHPmyAdmin: docker-compose up

Navigate to localhost:8080 in your browser to open PHPmyAdmin.

To close the connection, pressĀ Ctrl+C.

See the git repo here.


Further reading


Comment

Note: Comments are moderated, URLs not permitted.