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
• 9,330 points
1,429 views

7 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+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,280 points
+1 vote

This shouldn'be very difficult, follow these steps:

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

answered Apr 25 by Celia
+1 vote
I got the exact same error. I hadn't started the MySQL server.
answered Apr 25 by Gopal
+1 vote
From my experience, start your XAMPP server and then start your MySQL server.
answered Apr 25 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 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 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 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,100 points

edited Oct 16, 2018 by lina 2,537 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
• 9,330 points
54 views
+1 vote
1 answer
0 votes
1 answer
0 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
• 56,140 points
80 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 27, 2018 in Docker by Tyrion anex
• 8,280 points
379 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,280 points
31 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.