H
H
HellWalk2019-01-18 18:04:23
Docker
HellWalk, 2019-01-18 18:04:23

MySQL in Docker - how to connect?

Raised the container from the docker hub:
https://hub.docker.com/_/mysql
CONTAINER ID: 70bbb657317b
IMAGE: mysql:5.7
STATUS: Up 10 minutes
PORTS: 3306/tcp, 33060/tcp
NAMES mysql-5.7
If you go to the container itself, and from the inside to log into mysql - everything is OK
But here it is not possible to log in locally:
$ mysql -h 127.0.0.1 -u root -p
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
$ mysql -h localhost -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2
) PDO:
(HY000/2002): Connection refused in
How to connect to MySQL in docker?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
metalhead_kos, 2019-04-24
@metalhead_kos

MySQL in the container is on a different subnet, try ip like 172.17.0.1, then you should be able to connect through MySQL
then the password and everything should work like a charm =)
to determine what kind of network, ifconfig to help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question