1.拉取镜像
sudo docker pull mysql:8.0.18
2.运行docker
sudo docker run -p 3306:3306 --name mysql --restart=always --privileged=true \
-v /home/cy/soft/mysql/conf/mysql/log:/var/log/mysql \
-v /home/cy/soft/mysql/data:/var/lib/mysql \
-v /home/cy/soft/mysql/conf/mysql.conf:/etc/my.conf \
-v /etc/localtime:/etc/localtime:ro \
-e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0.18
3.查看日志
sudo docker logs -f 78ffe50725abf4f8ef862de8e5f5890961a70a820ed39952b5a28a00b26f3af9
4.mysql登录
mysql -h localhost -P 3306 -u root
5.mysql进入容器
sudo docker exec -it 78ffe50725abf4f8ef862de8e5f5890961a70a820ed39952b5a28a00b26f3af9 /bin/bash
标签:8.0,18,sudo,conf,mysql,docker From: https://www.cnblogs.com/Sigmund-Freud-01/p/18216689