镜像说明:https://hub.docker.com/_/mysql
下载镜像:
docker pull mysql:5.7
查看本地镜像:
docker images
运行镜像:
docker run --name mysql-5.7 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456pass -d mysql:5.7
attatch 镜像:
docker exec -it b91b6c8dfbb73d1de7f6b0aaa9c1a4d090c8161521e8ed2a429b8d659721fbab /bin/sh
在容器外访问容器内的MySQL服务:
mycli -h 127.0.0.1 -u root