Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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

--- 10.10.10.99 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 10.10.10.99 3306
Trying 10.10.10.99...
telnet: connect to address 10.10.10.99: Connection refused
telnet: Unable to connect to remote host: Connection refused

On the MySQL server:
# netstat -na | grep 3306
tcp        0      0 127.0.0.1:3306  0.0.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

2 Answers 2

up vote 2 down vote accepted

Somehow you've managed to tell MySQL to only bind to 127.0.0.1. 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 = 127.0.0.1 to bind-address = 10.10.10.99

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

share|improve this answer
1  
Changing to bind to 10.10.10.99 is a bad idea, unless you're also binding it to 127.0.0.1; better to bind to 0.0.0.0, 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 10.10.10.99 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

 
discard

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.