Information:
- Docker version (
$ docker --version
): Docker version 18.03.1-ce, version 9ee9f40
- System Information: WINDOWS10 Professional Edition
MySQL is mounted in Docker's volume
1. The first step:
1 Docker volume create Mysql-data
2. Step Two:
Create a MySQL folder
3. Step Three:
Re-create docker-compose.yml under MySQL folder
Because the latest version of Docker does not support the absolute path representation of/g/, the relative path to./is "relative to Docker-compose.yml")
1Version'3'2 Services:3 DB:4image:mysql/mysql-Server5container_name:db-MySQL6 restart:always7Command:mysqld--character-Set-server=utf8--collation-server=Utf8_general_ci8 Ports:9-"3306:3306" Ten Networks: One-net_db A Environment: - mysql_root_password:pwd123456 - volumes: the-mysql-data:/var/lib/MySQL - volumes: -mysql-Data: -Externaltrue + Networks: - net_db: +Externaltrue
4. Step Fourth:
Docker-compose up
5. Step Fifth:
Login: 1 Docker exec-it db-MySQL bash 2 3 mysql-uroot-p 4 pwd12 3456
If it appears
for ' Root '@'localhost' (using password:yes)
Please continue to see:
To delete a mirror:
List all images:
Docker images
Docker RMI IMAGE ID
Delete Volume
1 List all Volume:
2 docker volume ls
Docker Volume RM Mysql-data
Delete MySQL folder
Repeat the above operation and add the DB to the IV command.
1 docker-compose up db
1C:\users\gyw>docker exec-it db-MySQL bash2bash-4.2# Mysql-uroot-P3 Enter Password:4 Welcome to the MySQL Monitor. Commands End With; or \g.5Your MySQL Connection ID is -6Server version:8.0. OneMySQL Community Server-GPL7 8Copyright (c) -,2018, Oracle and/or its affiliates. All rights reserved.9 TenOracle isA registered trademark of Oracle Corporation and/or its One affiliates. Other names trademarks of their respective A owners. - -Type'Help ;'Or'\h' forHelp. Type'\c'To clear the current input statement. the -Mysql>
Done!!!
Docker mounts MySQL with volume mode Docker-compose login not in