当前位置:网站首页>Docker install MySQL 5.7
Docker install MySQL 5.7
2022-07-25 04:12:00 【Sun-yz】
One 、 Install the image
1. lookup Docker Hub Upper MySQL5.7 docker Mirror image
docker search mysql
2. Pull label as 5.7 Of MySQL docker Mirror image
docker pull mysql:5.7
3、 View the local image library
docker images

Two 、 establish mysql Containers
1. Create locally mysql Mapping directory for
mkdir -p /root/mysql/data /root/mysql/logs /root/mysql/conf
2. stay /root/mysql/conf Created in *.cnf file
touch my.cnf
3、 ... and 、 Mirror image
1. Create a container , Put the data , journal , Profile mapping to native
docker run -p 3306:3306 --name docker-mysql -v /root/docker/mysql57/conf:/etc/mysql/conf.d -v /root/docker/mysql57/logs:/logs -v /root/docker/mysql57/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
-p 3306:3306: The container of 3306 Port mapping to host's 3306 port
-v opt/docker_v/mysql/conf:/etc/mysql/conf.d: Put the host /opt/docker_v/mysql/conf The directory is attached to the container's /etc/mysql/conf.d
-e MYSQL_ROOT_PASSWORD=123456: initialization root User's password
-d: Background running container , And return to the container ID
imageID: mysql Mirror image ID
2. start-up mysql Containers
docker start mysql
3. see /root/mysql/data Whether the directory has data files 
4. Connect docker mysql
docker exec -it docker-mysql bash
It can also be done through docker ps -a Command to view containers that are already running , Then use the container ID Into the container .
a8d6e7cf3ce7 mysql:5.7 "docker-entrypoint.s…"
In the first column a8d6e7cf3ce7 That's the container. ID.
adopt exec Command to execute... On the specified container bash, Open the pseudo terminal
docker exec -it 9df70f9a0714 bash
Thank you for your patience in reading , If you have any suggestions, please send a private letter or comment
边栏推荐
- MySQL eight shares
- Application of AI in testing
- Server status code
- Function and technical principle of data desensitization [detailed explanation]
- Aggregate payment meets the needs of various industries to access a variety of payments
- DIY can decorate the mall system, you can also have!
- Pandora IOT development board learning (RT thread) - Experiment 16 WiFi module experiment (learning notes)
- [Flink] rich function
- Implementation of logistics repair reporting system based on SSM
- Press the switch for the minimum number of times to turn on all lights
猜你喜欢

226. Flip binary tree DFS method

使用 “display: flex;justify-content: center;align-items: center; ” 解决流式栅格布局无法居中的问题

Emergency response stack

Customized view considerations

What are the models of asemi from the manufacturer of rectifier bridge and how about the electroplating process of the manufacturer of rectifier bridge?

Detailed explanation of kubernetes network plug-in - flannel chapter

Localization distillation for dense object detection cvpr2022

Modbus poll/slave simulator tutorial

Pytorch deep learning practice lesson 8 importing data

DNS domain name resolution service
随机推荐
Openharmony Mengxin contribution Guide
Current characteristics of steering gear with great resistance
Behind Senma's LP, "Wenzhou Department" is running into the venture capital circle
Internship in 2022
The difference between apply, call and bind
Press the switch for the minimum number of times to turn on all lights
01_ Education 2
Operations in shell
An article takes you quickly to learn flex layout
Servlet personal practice notes (I)
基于SSH婴幼儿产品销售系统
Typical data Lake application cases
Bond network card mode setting
ES(8.1)认证题目
Emergency response stack
Maker concept design to adapt to popular education
Detailed explanation of kubernetes network plug-in - flannel chapter
DNS domain name resolution service
Deep learning method of building a model from zero
C language: string processing function