当前位置:网站首页>Docker starts mysql
Docker starts mysql
2022-08-03 08:04:00 【Brother Mu Yao】
Download MySQL image
Docker Hub link: https://hub.docker.com/_/mysql?tab=description
mysql 8.0.27 version is used here
$ docker pull mysql:8.0.27Create/Start/Configure MySQL container
Create a mysql container named mysql-8.0.27-container based on the image mysql:8.0.27, and set the root user passwordFor ******** (remember to map port 3306 to port 3306 of the host):
$ docker run--restart=always--privileged=true--name mysql-8.0.27-container-e MYSQL_ROOT_PASSWORD=********-p 3306:3306-dmysql:8.0.27If you need to mount the data volume (/var/lib/mysql) and configuration file (/etc/mysql/conf.d) to the data of the host hard diskVolume (/home/muyao/mysql) and (/home/muyao/conf), you need to use -v to map the following parameters, only the data volume is mapped here.Complete command:
$ docker run --name mysql-8.0.27-container -e MYSQL_ROOT_PASSWORD=******** -v /home/muyao/mysql:/var/lib/mysql -p 3306:3306 -d mysql:8.0.27Startup successful!
Enter the container and run the mysql command to enable remote permissions and refresh permissions:
$ docker exec -it mysql-8.0.27-container bash$ mysql -u root -p> grant all privileges on *.* to [email protected]'%' with grant option;> flush privileges;Execute the above command.
Execution result.It can be seen that the host of root should become %, that is, all ips are allowed.
Connection Test
Use the db plugin NoSQL of vscode to test the connection, which is successful.(Stepping on the pit: The mapping of 3306 was not done at the beginning, resulting in no successful connection.) 
边栏推荐
- ArcEngine (six) use the tool tool to realize the zoom in, zoom out and translation of the pull box
- Daily practice of PMP | Do not get lost in the exam-8.2 (including agility + multiple choice)
- 【云原生--Kubernetes】kubectl命令详解
- VR全景市场拓展技巧之“拓客宝典”
- Logic Pro X built-in sound library list
- 如何让背景色在任何设备宽高都能填充整个屏幕
- HCIP笔记整理 2022/7/20
- 五、《图解HTTP》报文首部和HTTP缓存
- Pop Harmony Basics Big Notes
- vim 折叠函数
猜你喜欢
随机推荐
Poke the myth of Web3?Poke the iron plate.
REST学习
【云原生--Kubernetes】Pod容器与镜像拉取策略
mysql服务器上的mysql这个实例中表的介绍
工控机防勒索病毒浅析
Transformer、BERT、GPT 论文精读笔记
AI mid-stage sequence labeling task: three data set construction process records
推荐系统-排序层-模型:Wide&Deep
实时目标检测新高地之#YOLOv7#更快更强的目标检测器
数据仓库指标体系实践
Karatsuba大数乘法的Verilog实现
学习笔记:机器学习之逻辑回归
学习Glide 常用场景的写法 +
Charles packet capture tool learning record
requests库
Roson的Qt之旅#106 QML在图片上方放置按钮并实现点击按钮切换图片
postman将接口返回结果生成csv文件到本地
Evaluate:huggingface评价指标模块入门详细介绍
2022下半年软考「高项&集成」复习计划ta来喽~
【图像边缘检测】基于matlab灰度图像的积累加权边缘检测【含Matlab源码 2010期】







