Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't connect to Docker container running MySQL Server

The Docker run command is:

docker run –name some-mysql -e MYSQL_ROOT_PASSWORD=flurpgraSS -d mysql:5.7

Docker Desktop shows the container:
enter image description here
I can access the server from the CLI launched by Docker Desktop and the root account appears to be OK:
enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I can’t access the server using MySQL Workbench
enter image description here

>Solution :

We might need to expose port from docker by -p parameter, otherwise, we can’t access it outside.

docker run --name some-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=Danger42! -d mysql:5.7

There is some description from Container networking

-p 3306:3306:Map TCP port 3306 in the container to port 3306 on the Docker host.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading