Container deployment MySQL, Tomcat, Nginx, Redis
One, deploy MySQL
1. Pull the mirror
# 拉取MySQL 5.7镜像
docker pull mysql:5.7
2. Create a container
# 创建mysql5.7容器
docker run -di --name=mysql5.7 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql5.7
- -p stands for port mapping, the format is host mapping port: container running port
- -e stands for adding the environment variable MYSQL_ROOT_PASSWORD which is the remote login password of the root user (if you use root login in the container, then the password is empty)
3. Operate the container MySQL
# 登录进入容器
docker exec -it mysql5.7 /bin/bash
# 登录容器里面的mysql
mysql -u root -p
4. Remote login to MySQL
Use Navicat to remotely log in to mysql in docker container in windows.