question

FarooqK-1300 avatar image
0 Votes"
FarooqK-1300 asked FarooqK-1300 edited

Azure deployed Linux VM mysql port not accessible

I have a Centos 7 deployed vm on azure, also deployed mysql on it and would like to access it remotely.

I also opened the port as show below:
202598-image.png


but I still can not access the port 3306, below screenshot from telnet:
202665-image.png



please note that port 80, 22 and 443 are accessible.
I am out of ideas why would this not work. Please help.

azure-virtual-machines
image.png (35.2 KiB)
image.png (12.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ManuPhilip avatar image
0 Votes"
ManuPhilip answered

First, make sure that Mysql is running well. service mysql status
You can verify the port is accessible within the server locally

 telnet localhost 3306



--please don't forget to upvote and Accept as answer if the reply is helpful--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FarooqK-1300 avatar image
0 Votes"
FarooqK-1300 answered

thanks for your response @ManuPhilip - I tried the telnet you suggested and it looks like it works locally:
202923-image.png



but the problem persists where I can't reach to this port remotely, I hope you can help.


image.png (10.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FarooqK-1300 avatar image
0 Votes"
FarooqK-1300 answered

@Prrudram-MSFT @vipullag-MSFT hopefully some insight from you.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ManuPhilip avatar image
0 Votes"
ManuPhilip answered

Looks like the “bind-address” to be modified to 0.0.0.0 from 127.0.0.1 to make sure that the mysql server will listening on all your VM's ips.
Go to /etc/mysql/mysql.conf.d/mysqld.cnf and modify bind-address from 127.0.0.1 to 0.0.0.0
Restart MySQL server systemctl restart mysql and try again




--please don't forget to upvote and Accept as answer if the reply is helpful--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FarooqK-1300 avatar image
0 Votes"
FarooqK-1300 answered

@ManuPhilip - I had already tried the bind-address conf setting and this didn't help at all.
203054-image.png



image.png (66.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ManuPhilip avatar image
0 Votes"
ManuPhilip answered ManuPhilip edited

Check, if the remote client can connect to your MySQL Server, by running the following command

 sudo netstat -anltp|grep :3306

If not, run the following command to open TCP port 3306. Change ethernet card name, if it is different than given in the command

 iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT






5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FarooqK-1300 avatar image
0 Votes"
FarooqK-1300 answered FarooqK-1300 commented

@ManuPhilip - I ran the command advised by you:
203144-image.png


next up I opened the tcp port as advised:
203176-image.png

still no success, telnet from remote machine not going through.


image.png (6.7 KiB)
image.png (13.2 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Try accessing by stopping the iptables- service iptables stop . Note that, this is not at all recommended for the production system

0 Votes 0 ·

@ManuPhilip - what I am using here is CentOS 7, looks like CentOS 7 doesn't come prepackaged with iptables service anymore, anyhow I installed the package, then start the service and then stopped the service as per your advice., also checked the status of firewalld service status and it is not running.

After that I tried telnet from remote machine to port 3306, still no success.

0 Votes 0 ·
FarooqK-1300 avatar image
0 Votes"
FarooqK-1300 answered FarooqK-1300 edited

@ManuPhilip - Thanks for your support, I have moved on from this instance of azure linux vm, considering it is unstable.

Not pursuing this ticket any further.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.