Docker compose file for MySQL 5.7

Published on 2019-09-26 • Modified on 2019-09-26

This is the docker compose file I am using for MySQL 5.7. As this is an official image, there should't be any problem. Before I was creating the container directly with Docker. But using Docker compose is so much easier! With this setup you can login with root/root. Don't use this in production. 😉


version: '3.7'

# docker-compose -f docker-compose.yaml up -d
services:

  # MySQL server database (official image)
  # https://docs.docker.com/samples/library/mysql/
  db:
    image: mysql:5.7
    container_name: db
    command: --default-authentication-plugin=mysql_native_password
    ports:
      - "3309:3306"
    environment:
      MYSQL_ROOT_PASSWORD: root

 More on Stackoverflow