当前位置:网站首页>docker安装mysql
docker安装mysql
2022-06-30 20:33:00 【塔塔塔塔塔塔y】
不指定版本号,默认下载最新版本:
docker pull mysql
指定版本号
docker pull mysql:5.7
镜像拉取完成后,用该镜像创建mysql实例,使用下面的命令来创建
sudo docker run \
-p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7
配置端口映射:
-p 3306:3306 --name mysql
将容器的3306端口映射到主机的3306端口
配置mysql数据卷挂载
1.-v /mydata/mysql/log:/var/log/mysql(日志文件挂载)
将容器中的日志文件夹挂载到主机对应的/var/log/mysql文件夹中
2.-v /mydata/mysql/data:/var/lib/mysql(数据文件挂载)
将容器中的数据文件夹挂载到主机对应的/var/lib/mysql文件夹中
3.-v /mydata/mysql/conf:/etc/mysql(配置文件挂载)
将容器的配置文件夹挂载到主机对应的/etc/mysql文件夹中
配置用户
-e MYSQL_ROOT_PASSWORD=root
设置初始化root用户的密码
指定镜像资源
-d mysql:5.7
-d:以后台方式运行实例
mysql:5.7:指定用这个镜像来创建运行实例
创建成功后使用下面命令查看下创建好的mysql实例:
docker ps -a
边栏推荐
- Lvalue reference and lvalue reference
- NLP paper lead reading | what about the degradation of text generation model? Simctg tells you the answer
- Study on lumiprobe dye NHS ester BDP FL NHS ester
- 请问海量数据如何去取最大的K个
- Lingyun going to sea | 10 leap &huawei cloud: jointly helping Africa with inclusive financial services
- Mistakes the project manager should not make
- QT qstringlist usage
- 数据库 OLAP、OLTP是什么?相同和不同?适用场景
- A complete collection of vulnerability scanning tools. Mom doesn't have to worry that I won't find any more vulnerabilities
- obsidian配合hugo的使用,让markdown本地编辑软件与在线化无缝衔接
猜你喜欢

All the important spark summit features were released here last night (with ultra clear video attached)

Lumiprobe生物素亚磷酰胺(羟脯氨酸)说明书
![Jerry's touch key recognition process [chapter]](/img/ec/25d2d6fd26571e4fb642129a4eee1b.png)
Jerry's touch key recognition process [chapter]

基于开源流批一体数据同步引擎ChunJun数据还原—DDL解析模块的实战分享

Lumiprobe biotin phosphimide (hydroxyproline) instructions

Lumiprobe染料 NHS 酯丨BDP FL NHS 酯研究

A complete collection of vulnerability scanning tools. Mom doesn't have to worry that I won't find any more vulnerabilities

哈夫曼树(一)基本概念与C语言实现

STL的基本组成部分

On the charm of code language
随机推荐
B_QuRT_User_Guide(33)
Peking University ACM problems 1002:487-3279
MySQL introduction, detailed installation steps and usage | dark horse programmer
北京大学ACM Problems 1005:I Think I Need a Houseboat
CentOS - enable / disable Oracle
Dynamic style binding --style and class
Study on lumiprobe modified triphosphate biotin-11-utp
unittest自动测试多个用例时,logging模块重复打印解决
C file pointer
Basic concepts of tree
Deflection lock / light lock / heavy lock lock is healthier. How to complete locking and unlocking
Lumiprobe cell biology - dia, instructions for lipophilic tracer
How can I get the stock account opening discount link? In addition, is it safe to open a mobile account?
Jenkins can't pull the latest jar package
断点续传和下载原理分析
Lumiprobe蛋白质定量丨QuDye 蛋白定量试剂盒
Lumiprobe 改性三磷酸盐丨生物素-11-UTP研究
Jerry's touch key recognition process [chapter]
MySQL:SQL概述及数据库系统介绍 | 黑马程序员
Lumiprobe 聚乙二醇化和 PEG 接头丨碘-PEG3-酸研究