Question

MySQL port showing close after changing bind-address to server's private address

I am using Digital Ocean’s droplet I want to access my database through my workbench. Earlier I was using Google’s compute engine with the same settings like changing bind-address to server’s private-ip and then creating user with same ip as a host. Example

my.cnf

port = 3306

bind-address = 10.223.0.1

MySQL user:

CREATE USER 'adam'@'10.223.0.1' IDENTIFIED BY 'abc@123';
GRANT ALL PRIVILEGES ON *.* TO 'adam'@'10.223.0.1' WITH GRANT OPTION;

I was able to access this user on my local machine with the use of server’s external IP.

But now if I update bind-address with my private IP and check with external port checker tool. it tells me that port 3306 is closed and if I change to 0.0.0.0 than port shows open and I am able to access. But the thing is, I am adding updating private ip as I want to replicate my database to another server. how I can solve this. Thank you in advance.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

If you specify only the private IP address as the bind address, then you will be able to connect to the MySQL instance only via that private IP address.

If you use an external service and try to access MySQL via the public IP of the Droplet, the port will be reported as closed.

Hope that this helps! Let me know if you have any questions.

Best,

Bobby