Install MySQL server with Docker Compose

Inside a new directory, create a data directory and docker-compose.yml with these rows: version: ‘3’   services: db: container_name: docker-local-mysql image: mysql:5.7.21 volumes: – "./data:/var/lib/mysql" restart: always ports: – 3306:3306 environment: MYSQL_ROOT_PASSWORD: passwordversion: ‘3’ services: db: container_name: docker-local-mysql image: mysql:5.7.21