当前位置:网站首页>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.) 
边栏推荐
- Windows安装MySQL(MIS)
- 训练正常&异常的GAN损失函数loss变化应该是怎么样的
- 如何使用电子邮件营销在五个步骤中增加产品评论
- 千万级别的表分页查询非常慢,怎么办?
- How to choose a reliable and formal training institution for the exam in September?
- 如何像用自来水一样使用数据库?|腾讯云数据库TDSQL-C
- wordpress: 裁剪您的图片时发生错误
- VR全景市场拓展技巧之“拓客宝典”
- [Kaggle combat] Prediction of the number of survivors of the Titanic (from zero to submission to Kaggle to model saving and restoration)
- 薛定谔的对象属性判断
猜你喜欢

volta管理node版本

Data warehouse buried point system and attribution practice

mysql的innodb存储引擎和myisam存储引擎的区别
![[Kaggle combat] Prediction of the number of survivors of the Titanic (from zero to submission to Kaggle to model saving and restoration)](/img/2b/d2f565d9221da094a9ccc30f506dc8.png)
[Kaggle combat] Prediction of the number of survivors of the Titanic (from zero to submission to Kaggle to model saving and restoration)

学习笔记:机器学习之逻辑回归

数据监控平台

Docker启动mysql

【图像去噪】基于matlab稀疏表示KSVD图像去噪【含Matlab源码 2016期】

Fortify白盒神器20.1.1下载及安装(非百度网盘)

审批流设计
随机推荐
DeFi明斯基时刻:压力测试与启示
- display image API OpenCV 】 【 imshow () to a depth (data type) at different image processing methods
千万级别的表分页查询非常慢,怎么办?
面试介绍项目经验(转)
How does Mysql query two data tables for the same fields in two tables at the same time
加速FinOps实践,为企业降本增效
Docker启动mysql
ArcEngine(三)通过MapControl控件实现放大缩小全图漫游
2022下半年软考「高项&集成」复习计划ta来喽~
redis AOF持久化个人理解
学习Glide 常用场景的写法 +
品牌方发行NFT时,应如何考量实用性?
薛定谔的对象属性判断
Qt5开发从入门到精通——第二篇(控件篇)
跨域嵌套传递信息(iframe)
pyspark---encode the suuid interval (based on the number of exposures and clicks)
sqlite date field plus one day
ArcEngine(二)加载地图文档
前缀和(区间和,子矩阵的和)
ArcEngine (2) loading the map document