0

I am trying to open port 3306 in Lucid, but when I do

netstat -tan|grep 3306

it just shows me

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN

What I am going for is:

tcp        0      0 0.0.0.0:3306          0.0.0.0:*               LISTEN

The probelm is, I can't see to change this. I have tried to use iptables and ufw, all to no avail. Any help will be appreciated.

honyovk
  • 101
  • 2

1 Answers1

3

It's not a firewall issue: mysql simply hasn't been configured to listen to anything but the loopback interface.

Edit /etc/my.cnf and look for a line like:

bind-address            = 127.0.0.1

Change that to 0.0.0.0 for it to listen on all interfaces and restart mysqld. Make sure the database isn't reachable from the Internet, etc., through other firewall rules.

cjc
  • 24,916
  • 3
  • 51
  • 70
  • Unfortunately, it is a firewall issue. I have already set the my.cnf file to reflect the necessary changes. – honyovk Feb 16 '12 at 17:17
  • 1
    The firewall has nothing to do with the ip an app binds too. – Zoredache Feb 16 '12 at 17:26
  • Maybe I was not clear about the issue. MySQL is set up to receive connections from both localhost and other IPs in its local network. The problem is that i cannot access the 3306 port from another machine. – honyovk Feb 16 '12 at 17:30
  • 2
    @MatthewJordan if you've changed my.cnf to 0.0.0.0 but it is binding to 127.0.0.1, then either you need to restart mysql, or you are editing the wrong file. otherwise you'd get the results you are looking for from netstat – stew Feb 16 '12 at 17:31
  • 1
    Please verify that you've actually restarted mysqld. Check the process start time with "ps auxw |grep mysql". It's possible you thought you restarted it, but it didn't really restart. – cjc Feb 16 '12 at 17:39