当前位置:网站首页>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
边栏推荐
- Jenkins continues to integrate entry to mastery
- 弹性布局(display:flex下 align-content、justify-content、align-items三个属性的作用和效果
- C language: Escape Character
- Student thinking vs workplace thinking
- Original | ueditor1.4.3-asmx bypasses WAF
- Redis official visualization tool, with high appearance value and powerful functions!
- [Flink] aggregation operator
- Deep learning method of building a model from zero
- [Flink] transform operator filter
- [laser principle and application -5]: laser diode LD (laser diode) and laser diode driver (LD driver)
猜你喜欢

Wechat applet access wechat payment process

How should enterprise users choose aiops or APM?

226. Flip binary tree DFS method

Attack and defense world ----- ics-05

It took me 2 years from Foxconn assembly line to Tencent software testing post~

数据中台建设(一):数据中台出现的背景
![[interview must brush 101] greedy algorithm, simulation, string](/img/ac/32f249c1884965710d82b8aca0c851.png)
[interview must brush 101] greedy algorithm, simulation, string

Wechat applet application development (I)

.net6 miniapi (V): Options

C language file operation
随机推荐
Maker concept design to adapt to popular education
DNS domain name resolution service
Digital collections can go further without hype
Serial adder / subtracter
Detailed explanation of kubernetes network plug-in - flannel chapter
GDAL image resampling
Interview question 08.07. Permutation and combination of non repeated strings DFS method
Implementing DDD based on ABP -- domain logic and application logic
ECCV 2022 | rethinking image blending for data enhancement in vision transformers
Interview question 05.06. integer conversion
(cvpr2020) reading of learning texture transformer network for image super resolution
Analytic hierarchy process of MATLAB
The latest Matlab download and installation tutorial (with files)
基于ABP实现DDD--领域逻辑和应用逻辑
Spirng security (VIII) multiple filter chains coexist
MySQL eight shares
Day008 select structure (switch statement)
[Flink] transform operator flatmap
Execution flow control of shell
Apache Doris series: in depth understanding of real-time analytical database Apache Doris