mysql installed by docker, unable to connect using database client

As shown in the title, using the docker container installed by centos, the 5.6 version of mysql is deployed in it. As a result, the container can be directly connected, but the machine cannot be connected:
Solution:
1. Edit the configuration file:

vi /usr/lib/sysctl.d/00-system.conf

Insert picture description here
Add a sentence at the end of the file:

net.ipv4.ip_forward=1

Then restart the network, stop the mysql container, delete the mysql container, and make a new MySQL container from the mirror:

systemctl restart network
docker stop (容器id)        //使用docker ps查看
docker rm mysql
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:5.6

Final problem solving

Published 39 original articles · won praise 1 · views 4620

Guess you like

Origin blog.csdn.net/thetimelyrain/article/details/103302904