Docker MySQL DataBase


$ vi docker-compose.yml


version: '3'
services:
  mysql-dev:
    restart: always
    image: mysql:8.0
    ports:
      - '3306:3306'
    volumes:
      - ./mysql:/etc/mysql/conf.d
    environment:
      MYSQL_DATABASE: db
      MYSQL_ROOT_PASSWORD: pA55w0rd123


$ docker-compose up


$ telnet localhost 3306


$ sudo apt update -y
$ sudo apt install -y mysql-client


$ mysql --user=root --password=pA55w0rd123 -h 127.0.0.1 db


mysql> SELECT DATABASE();