When deploying under Docker, you use the command line to pull. Make sure to use container image acceleration before pulling.
For container image acceleration settings, refer to the second part of my previous article CentOS7 Deploying Docker : https://www.cnblogs.com/hanxiaobei/p/13073031.html
Start our perfect deployment experience
1. Pull mysql: docker pull mysql:latest
2、直接启动mysql:docker run -itd --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
View all docker containers: docker ps -a
3. Enter MySQL
进入MySQL:docker exec -it mysql bash
4. Remote connection is available under settings
1 use mysql; 2 ALTER user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; 3 FLUSH PRIVILEGES;
5. If the connection is not successful yet, it is recommended to restart the Docker container: docker restart CONTAINER ID
6. Remotely connect to MySQL in docker: IP=docker’s IP, user=root, password=123456