一、mysql安装
创建mysql容器
docker run -p 3306:3306 --name mysql8 \
-v /root/mydocker/mysql/log:/etc/mysql/log \
-v /root/mydocker/mysql/data:/etc/mysql/data \
-v /root/mydocker/mysql/conf:/etc/mysql/conf \
-v /root/mydocker/mysql/mysql:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456789 \
-d mysql:8.0
进入容器
docker exec -it cbc511714b6f /bin/bash
进入mysql控制台
mysql -uroot -p
查看并修改root的密码加密方式
use mysql;
select user,host from user;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root@123';
ALTER USER 'root'@'%' IDENTIFIED BY 'Root@123';
alter user 'root'@'%' identified with mysql_native_password by 'Root@123';
flush privileges;
二、redis安装
拉取redis镜像
docker pull redis:latest
创建redis容器并设置密码
docker run -d --name redis -p 6379:6379 redis --requirepass 123456abc