How to connect to a Docker container running mysql on Windows 10

+1 vote

I cannot figure out how to connect to my container from the host. I have tried localhost and 127.0.0.1. But I get an error like this:

/* Connecting to 127.0.0.1 via MySQL (TCP/IP), username root, using password: Yes ... */
/* Can't connect to MySQL server on '127.0.0.1' (10061) */

docker ps I get the following:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
300248b56399        mysql:5.6           "docker-entrypoint.sh"   About an hour ago   Up About an hour    3306/tcp            memories
Sep 5, 2018 in Docker by Sophie may
• 10,610 points
12,062 views

7 answers to this question.

+1 vote

This is simple, just publish port 3306

docker run -p 3306:3306 --name memories -e MYSQL_ROOT_PASSWORD=password -d mysql:5.6
answered Sep 5, 2018 by Tyrion anex
• 8,700 points
+1 vote

This shouldn'be very difficult, follow these steps:

Start => services => MySQL(ver) => Right-Click => Start

answered Apr 25, 2019 by Celia
+1 vote
I got the exact same error. I hadn't started the MySQL server.
answered Apr 25, 2019 by Gopal
+1 vote
From my experience, start your XAMPP server and then start your MySQL server.
answered Apr 25, 2019 by Kishore
+1 vote
In my case, I hadn't installed the mysql server itself. I installed it and the error disappeared.
answered Apr 25, 2019 by Vinod
+1 vote

Follow these steps:
run MySQLInstanceConfig.exe
C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\MySQLInstanceConfig.exe
Follow until the end without changing anything.

answered Apr 25, 2019 by Bhavesh
+1 vote

Avoid using bind_address in your my.cnf file. I don't know why but this helped me! If somebody knows the reason why, do let me know. Thank you!

answered Apr 25, 2019 by Haseeb

Related Questions In Docker

+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,220 points

edited Oct 16, 2018 by lina 32,899 views
0 votes
1 answer

How to continue running a docker container which is already exited?

Restart an existing container after you exited ...READ MORE

answered Jul 19, 2018 in Docker by Sophie may
• 10,610 points
2,258 views
+1 vote
1 answer
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,090 points
2,435 views
0 votes
1 answer

How to install telnet in Docker for Windows 10?

If you are trying to telnet in ...READ MORE

answered Aug 28, 2018 in Docker by Tyrion anex
• 8,700 points
3,121 views
0 votes
1 answer

How to save a Dynamic port in Docker for Windows?

The mapped ports can be accessed via ...READ MORE

answered Sep 4, 2018 in Docker by Tyrion anex
• 8,700 points
591 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP