Configure Mysql Workbench in docker

0

I want to set up my workbench so you can connect with mysql that is running on my docker server but when I try to test the connection, always get the following error:

IcreatedtheMysqlcontainerusingdocker-compose.Hereistheconfigurationofmydocker-compose.yml:

php:build:.ports:-"80:80"
    - "443:443"
  volumes:
    - ./teste:/var/www/html
  links: 
    - mysql  

mysql:
  image: mysql:latest
  volumes:
   - /var/lib/mysql
  environment:
   - MYSQL_ROOT_PASSWORD=123456
   - MYSQL_DATABASE=docker

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  links:
   - mysql
  ports:
   - 3306:80
  environment:
   MYSQL_USERNAME: root
   MYSQL_ROOT_PASSWORD: 123456
   PMA_HOST: mysql

I'm using windows 10 with version 13.07.1 of docker. Both the mysql workbench and my server are running locally.

Currently for me to access my docker project just type localhost in my browser, and to access the phpmyadmin localhost: 3306.

    
asked by anonymous 05.06.2017 / 03:50

2 answers

1

You must map the port of the mysql docker to the host. In your case it would look like the mysql section:

mysql:
  image: mysql:latest
  volumes:
   - /var/lib/mysql
  environment:
   - MYSQL_ROOT_PASSWORD=123456
   - MYSQL_DATABASE=docker
  ports:
   - 3306:3306
    
05.06.2017 / 03:54
0

It provides a port in mysql tbm, and the port that you make available vc puts in the workbench tbm. Dai sure will work

    
05.06.2017 / 04:03