Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql remote connection issue #20

Closed
sachi842 opened this issue Aug 13, 2017 · 19 comments
Closed

mysql remote connection issue #20

sachi842 opened this issue Aug 13, 2017 · 19 comments
Assignees

Comments

@sachi842
Copy link

I am trying to expose 3306 to my Docker host via: -p "3306:3306". I cannot connect to 3306 from outside the container.
Someone on the Docker Slack community helped, and it looks like MySQL is bound to 127.0.0.1:3306 inside the container, not 0.0.0.0:3306.
Can you take a look?

root@117903e45f7f:/# apt install net-tools && netstat -lnp | grep 3306
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 175 kB of archives.
After this operation, 725 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 net-tools amd64 1.60-26ubuntu1 [175 kB]
Fetched 175 kB in 0s (202 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package net-tools.
(Reading database ... 17375 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60-26ubuntu1_amd64.deb ...
Unpacking net-tools (1.60-26ubuntu1) ...
Setting up net-tools (1.60-26ubuntu1) ...
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -

@mattrayner
Copy link
Owner

sure, I'll try and take a look at this today for you 👍

@mattrayner mattrayner self-assigned this Aug 14, 2017
@sachi842
Copy link
Author

sachi842 commented Aug 14, 2017 via email

@sachi842
Copy link
Author

sachi842 commented Aug 16, 2017 via email

@Ali-Kiyan
Copy link

@sachi842 @mattrayner I am having the same problem. I cannot access the mysql database from outside the container. I mapped the port 3306 to 3050.

@mattrayner
Copy link
Owner

I'm going to have another look at this now

@Ali-Kiyan
Copy link

Ali-Kiyan commented Aug 21, 2018

I found the solution for MySQL remote access outside of the container. edit MySQL config file under etc and change the binding address to 0.0.0.0 and then restart MySQL. finally, restart the LAMP container.

@mattrayner
Copy link
Owner

I've added this to the Dockerfiles and am testing now:

RUN sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf```

mattrayner added a commit that referenced this issue Aug 21, 2018
mattrayner added a commit that referenced this issue Aug 21, 2018
@mattrayner
Copy link
Owner

Fixed in #36

@tangruize
Copy link

tangruize commented Feb 28, 2019

I found it still does not work. Maybe the the file name /etc/mysql/my.cnf changed to /etc/mysql/mysql.conf.d/mysqld.cnf?

@Ali-Kiyan
Copy link

Try this:
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf

@tangruize
Copy link

Sorry, I'm new to docker. I tried docker commit to save changes, however it doesn't work. Could you update the image?

@doron-mil
Copy link

I'm running the latest-1804.
I still has problem as described.
Help, anyone?

@freeyland
Copy link

Same issue

@pzhlkj6612
Copy link
Contributor

See it #63 , a temporary solution.

@doron-mil
Copy link

doron-mil commented Jun 11, 2019

@pzhlkj6612 :
Thanks. At first didn't see the problem with the mysql restart. but after fixing that - all is working
Thanks again

@freeyland
Copy link

Thanx also working for me now

@mattrayner
Copy link
Owner

I'm adding the fix here to the Dockerfile for 1604 and 1804 - once I've got a fix I'll post it here

@mattrayner
Copy link
Owner

This should now be fixed in the latest release

Thanks for all your patience, if you can confirm and post back that would be amazing!

@freeyland
Copy link

Hi, it is working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants