0

I am running an ubuntu server, which has a LAMP stack. The problem is I can't access MySQL remotely.

I have uncommented the bind-address, in the my.cnf file, but this has no effect.

netstat -tap | grep mysql output is:

tcp        0      0 *:mysql                 *:*                     LISTEN      18079/mysqld    
tcp        0      0 localhost:mysql         localhost:45288         TIME_WAIT   -               
tcp        0      0 localhost:mysql         localhost:45802         ESTABLISHED 18079/mysqld    
tcp        0      0 localhost:mysql         localhost:45286         TIME_WAIT   -               
tcp        0      0 localhost:45802         localhost:mysql         ESTABLISHED 18134/sshd: root
tcp        0      0 localhost:45287         localhost:mysql         TIME_WAIT   -   

I can't telnet the server on port 3306 either, although I have made sure that port 3306 is open, using this command:

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

Telnet output is:

Operation timed out
telnet: Unable to connect to remote host

Result of iptables -L -nv:

 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3306 
    0     0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3306 
7
  • You need to provide the complete list of your firewall rules. You may have another rule that is prohibiting access to mysql.
    – Khaled
    Aug 1, 2012 at 8:04
  • That iptables command is not a guarantee that port 3306 is now open. Could you add the output of iptables -L -nv?
    – Ladadadada
    Aug 1, 2012 at 8:05
  • Have you the same result if you try your telnet command (with your public IP) from your server which hosts your mysql ? Are you sure about your network interface name (for the iptables command)? Aug 1, 2012 at 8:06
  • fire up your favorite sniffer (e.g. tcpdump). Do you see incoming port 3306 traffic?
    – Zoredache
    Aug 1, 2012 at 8:07
  • Added iptables -L -nv data to original question
    – Kao
    Aug 1, 2012 at 8:09

1 Answer 1

1

The output from iptables shows that it has never seen any traffic on port 3306. (at least since the last flush of the counters).

Something else is blocking that port before it reaches your box. Call your hosting provider.

2
  • I'd check to see if you can connect via the address configured on eth0 first - if not that would confirm it was being blocked elsewhere.
    – symcbean
    Aug 1, 2012 at 8:31
  • Tried to tcpdump -i eth0 port 3306, no traffic coming. I guess this confirms that it was blocked somewhere else. I'm currently waiting for a VMWare restart, which opens port 3306, I'll accept when I confirm it works.
    – Kao
    Aug 1, 2012 at 8:41

You must log in to answer this question.

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