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

netstat -tan|grep 3306

it just shows me

tcp        0      0*               LISTEN

What I am going for is:

tcp        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.


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            =

Change that to 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.

  • 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 but it is binding to, 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.