Docker for mac cant connect to mysql

broken image
broken image

Add remote login to mysql (important) 1) Query out the container_id of mysql in the docker container docker ps 2) Log in to the mysql container, where mysql is the container_id found above docker exec -it mysql bash Use the docker ps command to check whether the installation is successful:Ģ. MYSQL_ROOT_PASSWORD=123456: Set the password of the root user of the MySQL service.External hosts can directly access the MySQL service through the host ip:3306. -p 3306:3306Port 3306 of the container service is mapped to port 3306 of the host machine.The detailed installation process can be seen in the rookie tutorial ( ) 1) Pull the image docker pull mysql:latest 2) View local mirror docker imagesĪfter the installation is complete, we can use the following command to run the mysql container: $ docker run -itd -name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql