1

I'm trying to connect to mysql server installed on my computer.

When I enter "telnet localhost 3306", I get some garbage characters meaning that I'm connected to the server.

But when I enter "telnet my_computer_name 3306", I am getting this error:

Trying 127.0.1.1...
telnet: Unable to connect to remote host: Connection refused

I know that I has something to do with the firewall.

I also pasted output of my iptables-save here: http://pastebin.com/rKMc1bG8

I tried to add a rule to accept incoming connecting to 3306 but no success. Any fix?

1 Answer 1

2

It is not a problem with your firewall, it is an issue of mysql.

Edit /etc/mysql/my.cnf , change the bind-address

bind-address = 127.0.0.1

To your local ipaddress

bind-address     = your_ip_address

Restart the mysql or reboot.

2
  • 3
    You probably want to bind to 0.0.0.0 That way you accept connections from all network interfaces, including localhost (127.0.0.0.1) and your ethernet interface. It is generally safer though to only allow connections on localhost. In most cases you just want applications on the same machine to access the database, not other machines on the network (or worse Internet). In turn configure your application to connect to localhost. Never open any network ports that you do not absolutely require open.
    – jippie
    Apr 16, 2012 at 21:03
  • This is what I did at the end. Actually, I'm creating an android application, so I need to allow connections from any address. Apr 17, 2012 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .