当前位置:网站首页>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.) 
边栏推荐
猜你喜欢

pyspark---encode the suuid interval (based on the number of exposures and clicks)

SSM整合流程

mysql5.7服务器The innodb_system data file 'ibdata1' must be writable导致无法启动服务器

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

用diskpart的offline命令弹出顽固硬盘

循环神经网络RNN基础《PyTorch深度学习实践》

五、《图解HTTP》报文首部和HTTP缓存

How does Mysql query two data tables for the same fields in two tables at the same time

Mysql如何对两张表的相同字段,同时查询两张数据表

Nacos使用实践
随机推荐
品牌方发行NFT时,应如何考量实用性?
Shell运维开发基础(一)
xshell开启ssh端口转发,通过公网机器访问内网机器
Postman will return to results generated CSV file to the local interface
The use of the database table structure document generation tool screw
剑指offer专项突击版第18天
ArcEngine(六)用tool工具实现拉框放大缩小和平移
数据仓库指标体系实践
Neo4j 4.X:导入OWL文件
vim 折叠函数
用云机器/虚拟机架设方舟游戏?
【C语言】函数栈帧的创建和销毁详解
积分商城系统设计
rust 学习笔记
Nanny level explains Transformer
ArcEngine(五)用ICommand接口实现放大缩小
Nacos使用实践
【云原生--Kubernetes】Pod重启策略
22-08-02 西安 尚医通(02)Vscode、ES6、nodejs、npm、Bable转码器
“碳中和”愿景下,什么样的数据中心才是我们需要的?