当前位置:网站首页>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.27
Create/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.27
If 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.27
Startup 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.)
边栏推荐
- JS作用对象API技巧
- 如何在安装GBase 8c数据库的时候,报错显示“Host ips belong to different cluster?
- redis AOF持久化个人理解
- Arduino框架下对ESP32 NVS非易失性存储解读以及应用示例
- [Hello World] 二分查找笔记
- ArcEngine (2) loading the map document
- 请求与响应:响应
- ViewModel 记录下 +
- ArcEngine(五)用ICommand接口实现放大缩小
- The use of the database table structure document generation tool screw
猜你喜欢
DeFi明斯基时刻:压力测试与启示
Shell运维开发基础(一)
【图像去雾】基于matlab暗通道和非均值滤波图像去雾【含Matlab源码 2011期】
@Async注解的坑,小心
Nacos使用实践
day12---接口和协议
mysql5.7服务器The innodb_system data file 'ibdata1' must be writable导致无法启动服务器
pyspark---encode the suuid interval (based on the number of exposures and clicks)
DSP Trick:向量长度估算
pyspark df secondary sorting
随机推荐
Nacos使用实践
pyspark---low frequency feature processing
STL-vector容器
使用pipreqs导出项目所需的requirements.txt(而非整个环境)
postman将接口返回结果生成json文件到本地
千万级别的表分页查询非常慢,怎么办?
JS函数获取本月的第一天和最后一天
sqlserver2019安装失败
Mysql如何对两张表的相同字段,同时查询两张数据表
HCIP笔记整理 2022/7/20
工控机防勒索病毒浅析
基于SSM开发的的小区物业管理系统小程序源码
学习笔记:机器学习之逻辑回归
集群
【云原生--Kubernetes】Pod重启策略
[ 漏洞复现篇 ] yapi 代码执行 getshell 漏洞复现详解
Golang协程goroutine的调度与状态变迁分析
pyspark df secondary sorting
Evaluate: A detailed introduction to the introduction of huggingface evaluation indicator module
Roson的Qt之旅#105 QML Image引用大尺寸图片