Home > OS >  Can't connect to Docker container running MySQL Server
Can't connect to Docker container running MySQL Server

Time:04-26

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

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

CodePudding user response:

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.

  • Related