1

I have a mysql container like this : enter image description here

I want to open the mysql using mysql workbench, does anyone know how ??

I am still confused how to fill this data .. enter image description here

I hope there is a solution to my problem

yusuf
  • 131
  • 2
  • 6

1 Answers1

2

tl;dr You have to publish MySQL's port 3306 to the "outside" using the -p switch.


Container ports are not accessible by default to the "outside" and are only open to other containers in the same network.

Run your MySQL image with -p 15000:3306 (map local port 15000 to container's port 3306) then connect in the Workbench to localhost at port 15000. You can choose any port you want, it can be 3306 too: -p 3306:3306.

Example docker run command:

docker run -it --rm -v mysql:/var/lib/mysql -p 3306:3306 mysql

In case of docker-compose:

services:
  # …
  mysql:
    # …
    ports:
      - 3306:3306
Mike Doe
  • 16,349
  • 11
  • 65
  • 88