title: Connecting to mysql server over telnet
body: <p>I am running mysql in a debian linux system that runs on a vm over Windows 7. I have modified iptables to accept connections from anywhere over port 3306 - but I can't do a telnet to it from Windows. Although I can ping the vm and make sure its accessible.</p>
  
  <p>Here's the iptables details:</p>
  
  <pre><code># sudo iptables -L
  CHAIN INPUT (policy ACCEPT)
  target        prot opt source        destination
  ACCEPT        tcp  --  anywhere      anywhere         tcp dpt:mysql
  
  CHAIN FORWARD (policy ACCEPT)
  target        prot opt source        destination
  
  CHAIN OUTPUT (policy ACCEPT)
  target        prot opt source        destination
  #
  </code></pre>
  
  <p>Here's what I enetered to add the rule:</p>
  
  <pre><code>-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
  </code></pre>
  
  <p>I can successfully ping to the debian vm, but when I try to do a telnet from the windows host I get:</p>
  
  <pre><code>Could not open connection to the host, on port 3306: Connect failed
  </code></pre>
  
  <p>I also tried doing a telnet from within debian. Here's what I got:</p>
  
  <pre><code>$ telnet localhost 3306
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  6
  5.1.73-1*?MH]~"* wG;2(oz9JJrConnection closed by foreign host.
  $
  </code></pre>
  
  <p>The debian system waits for a while before closing the connection by itself. Or I could do a ^] and close it.</p>