当前位置:网站首页>Docker-compose安装mysql
Docker-compose安装mysql
2022-07-30 05:14:00 【m0_67391518】
介绍
本系列文章主要介绍使用docker-compose部署mysql,nginx,redis等中间件,前后分离微服务项目部署流程。不介绍docker安装以及基础命令,话不多说首先进入mysql安装教学。
操作
首先创建个目录用来存放docker-compse文件以及mysql数据存放地址

docker-compose文件如下
version : '3'
services:
zzx-mysql:
# 容器名(以后的控制都通过这个)
container_name: zzx-mysql
# 重启策略
restart: always
image: mysql:5.7
ports:
- "3306:3306"
volumes:
# 挂挂载配置文件
# - ./mysql/db/:/docker-entrypoint-initdb.d
# 挂挂载配置文件
- ./mysql/conf:/etc/mysql/conf.d
# 挂载日志
- ./mysql/logs:/logs
# 挂载数据
- ./mysql/data:/var/lib/mysql
command: [
'mysqld',
'--innodb-buffer-pool-size=80M',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci',
'--default-time-zone=+8:00',
'--lower-case-table-names=1'
]
environment:
# root 密码
MYSQL_ROOT_PASSWORD: 123456
通过docker images命令可以看到此时我们本地仓库没有mysql5.7的镜像,mysql文件夹下也是空的


接下来我们在docker-compose目录下执行docker-compose up -d zzx-mysql命令

此时我们已经完成了在docker环境下mysql5.7的安装

打开mysql文件夹我们可以看到容器内的配置文件,日志,数据都已经挂载到了宿主机下
然后我们打开navicat尝试连接

连接已经完成了,下一节我们尝试docker-compose环境下安装redis,重要的事说三遍。
王亘是ben比!!!!!
王亘是ben比!!!!!
王亘是ben比!!!!!
边栏推荐
- mysql无法远程连接 Can‘t connect to MySQL server on ‘xxx.xxx.xxx.xxx‘ (10060 “Unknown error“)
- Dynamically bind href url
- Hexagon_V65_Programmers_Reference_Manual (14)
- RadonDB MySQL on K8s 2.1.4 发布!
- RadonDB MySQL on K8s 2.1.2 发布!
- “幻核”跑路,数字藏品路在何方?
- Some understanding of YOLOv7
- [High Performance Computing] openMP
- 上交所行情文件解析之mktdt04
- VisualStudio2022 local debugging entry is particularly slow problem solving
猜你喜欢

mysql无法远程连接 Can‘t connect to MySQL server on ‘xxx.xxx.xxx.xxx‘ (10060 “Unknown error“)

Predictive maintenance scheduling of multiple power equipment based on data-driven fault prediction

Small program npm package--API Promise

动态规划问题(完结篇)

上交所行情文件解析之mktdt04

WPF introduces ttf icon file usage record

3. Dependency configuration management

Unity stepping on the pit record - the use of GetComponent

GO language study notes one

Usage when saving pointers in std::vector
随机推荐
视野 | KeyDB:为 Web 应用而生的高性能 Redis 分支
给小白的 PG 容器化部署教程(下)
Golang——从入门到放弃
ThinkPHP high imitation blue play cloud network disk system source code / docking easy payment system program
LeetCode Algorithm 2326. Spiral Matrix IV
Double pointer problem (middle)
翻译 | Kubernetes 将改变数据库的管理方式
The Double Pointer Problem (Part 1)
22-07-29 西安 分布式事务、Seata
坪山区关于开展2022年度科技创新专项资金申报工作的通知
[3D Detection Series-PointRCNN] Reproduces the PointRCNN code, and realizes the visualization of PointRCNN3D target detection, including the download link of pre-training weights (starting from 0 and
Usage when saving pointers in std::vector
BindingExpression path error: 'selectMenusList' property not found on 'object' ''ViewModel'
Summary of skills in using ms project2010 project management software
Stimulsoft ReportsJS and DashboardsJS. 2022.3.3
Unity stepping on the pit record - the use of GetComponent
“幻核”跑路,数字藏品路在何方?
即刻报名|前沿技术探索:如何让 Spark 更强劲、更灵活
pytorch官网中如何选择以及后面的安装和pycharm测试步骤
mysql cannot connect remotely Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10060 "Unknown error")