Docker篇章8:安装mysql/redis
Docker篇章8:安装mysql/redis
1.mysql
docker search mysql # 拉取mysql:5.6 docker pull mysql:5.6 # 启动容器 docker run -p 12345:3306 --name mysql -v /xujunkai/mysql/conf:/etc/mysql/conf.d -v /xujunkai/mysql/logs:/logs -v /xujunkai/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6 # 交互模式进入mysql容器 docker exec -it 容器ID /bin/bash # 数据库备份 docker exec 容器ID sh -c ‘exec mysqldump --all-databases -uroot -p"123456"‘ > /xujunkai/all-databases.sql
2.redis
docker pull redis:3.2 docker run -p 6379:6379 -v /xujunkai/myredis/data:/data -v /xujunkai/myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:3.2 redis-server /usr/local/etc/redis/redis.conf --appendonly yes # --appendonly yes 开启持久化 # 编辑redis配置 vim /xujunkai/myredis/conf/redis.conf/redis.conf # 启动redis客户端 docker exec -it 容器id redis-cli
相关推荐
emmm00 2020-11-17
王艺强 2020-11-17
aydh 2020-11-12
世樹 2020-11-11
zry 2020-11-11
URML 2020-11-11
spurity 2020-11-10
yifangs 2020-10-13
Andrea0 2020-09-18
Ida 2020-09-16
ltd00 2020-09-12
tufeiax 2020-09-03
xjd0 2020-09-10
greatboylc 2020-09-10
adsadadaddadasda 2020-09-08
疯狂老司机 2020-09-08
CoderToy 2020-11-16
ribavnu 2020-11-16
bianruifeng 2020-11-16