1: Install docker
Docker in Windows can depend on two environments, namely:Hyper-V
、WSL
。
The first is a virtual environment, that is, a virtual machine, and the second is Windows' Linux subsystem (the system requirements are not lower than the 2021 version of Window10).
I chooseWSL: Windows Subsystem for Linux (WSL for short)
After all, virtual machines are definitely uselessLinux
The system responds quickly.
1. Prerequisite:
1.1 Turn on or off in Windows functions: Hyper-V and WSL. Then restart the computer;
1.2 Administrator runsPowerShell
, run the first two commands. If the subsystem has not been installed, it will help you install and will automatically update.
# Download or updatewsl --update # Restartwsl --shutdown
1.3 GoWindows
Download the app store, currentlyUB
,DB
ofLinux
There are all systems, I choseKali
,andWSL
SupportedLinux
The desktop does not require simple command line.
2. Install DockerDesktop and restart the computer after installation;
3. Configure DockerDesktop:
3.1 General: Expose daemon on tcp://localhost:2375 without TLS . Use the WSL 2 based engine
3.2 Docker Engine: Added: "registry-mirrors":["."]
4. Use Docker:
Divide local and hub, search for mysql in hub, pull to local, and it will not start by default. Run a container based on image and configure port number 3306.
The panel has not been started, and the container is run manually:
4.1 Create a folder under the current user of the C drive
C:\Users\ye\dockerspace\mysql8.0\ ,Newconf,data,logsFolders
docker run --name mysql9 -v C:\Users\ye\dockerspace\mysql8.0\conf\:/etc/ -v C:\Users\ye\dockerspace\mysql8.0\data:/var/lib/mysql -v C:\Users\ye\dockerspace\mysql8.0\logs:/logs -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest --lower-case-table-names=1 --default-time_zone='+8:00'
4.2 docker ps check whether it is created successfully
4.3 docker exec -it 3bcf /bin/bash (3bcf is the container id)
4.4 mysql -u root -p123456
The mapping file has not been effective here: C:\Users\ye\dockerspace\mysql8.0\conf\:/etc/
5. Connect to mysql using the client.
Data reference
MySQL part is reproduced from: /weixin_42197001/article/details/138184306#mysql8_7
This is the end of this article about the entire process of installing MySQL8.0 in Window Docker. For more related content on installing MySQL8.0 in Window Docker, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!