Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can ping to mysql server but can not telnet to 3306 port.

# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.128 ms
64 bytes from icmp_seq=2 ttl=64 time=0.099 ms

--- ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.099/0.113/0.128/0.018 ms

# telnet 3306
telnet: connect to address Connection refused
telnet: Unable to connect to remote host: Connection refused

On the MySQL server:
# netstat -na | grep 3306
tcp        0      0*  LISTEN   

Firewall is disabled on mysql server. This was working as expected. But I did 2 changes on mysql server. Reinstalled mysql and installed a third party software recently. How do I connect to mysql server on port 3306?

share|improve this question
up vote 2 down vote accepted

Somehow you've managed to tell MySQL to only bind to Edit /etc/my.cnf and change the bind-address option, or remove it altogether.

share|improve this answer
Depending on the distribution that is usually the default setup. – Squidly Aug 11 '11 at 1:45

The issue is displayed in your netstat output. Mysql is bound to the loopback address.

Check your /etc/mysql/my.cnf (if you are running Debian, or ubuntu) and change the bind-address from
bind-address = to bind-address =

Also I would make sure you have proper security and firewall rules setup to protect your mysql server.

share|improve this answer
Changing to bind to is a bad idea, unless you're also binding it to; better to bind to, in case he accesses the MySQL server directly from the server. – laebshade Aug 7 '11 at 4:09
The reason I said to bind to the address is so it's a specified address, if you have multiple IP's this would expose it to other networks and interfaces that may not be as protected. – Squidly Aug 11 '11 at 1:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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