docker-compose exec mysql mysql -u root -p
CREATE USER 'root'@'%' IDENTIFIED BY 'MYSQL_ROOT_PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
networks: | |
dev: | |
driver: bridge | |
attachable: true | |
services: | |
mysql: | |
command: --default-authentication-plugin=mysql_native_password | |
image: mysql:latest | |
expose: | |
- 3306 | |
ports: | |
- '3306:3306' | |
volumes: | |
- mysql-data:/var/lib/mysql | |
environment: | |
MYSQL_ROOT_PASSWORD: MYSQL_ROOT_PASSWORD | |
MYSQL_ROOT_HOST: 0.0.0.0 | |
restart: 'no' | |
networks: | |
- dev | |
version: '3.5' | |
volumes: | |
mysql-data: |