title: Vagrant port forwarding for Mysql
body: <p>I am trying to setup port forwarding in Vagrantfile to connect to guest mysqld from host system, but get <code>reading initial communication packet</code> error.
  Host: Yosemite, Guest: Trusty, vagrant 1.7.4</p>
  
  <p>Vagrantfile(host):</p>
  
  <pre><code>config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "forwarded_port", guest: 3306, host: 3309
  </code></pre>
  
  <p>my.ini(guest):</p>
  
  <pre><code>bind-address            = 127.0.0.1
  </code></pre>
  
  <p>8080 forwarding works like a charm.</p>
  
  <p><code>mysql -h127.0.0.1 -uroot -p</code> from guest also works.</p>
  
  <p><code>mysql -h127.0.0.1 -P 3309 -uroot -p</code> from host results with <code>reading initial communication packet</code> error.</p>
  
  <p>When I telnet from host, the connection instantly closes:</p>
  
  <pre><code>$ telnet localhost 3309
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  Connection closed by foreign host.
  </code></pre>
  
  <p>Port forwarding works when I ssh to vagrant box from host:</p>
  
  <pre><code>$ssh vagrant@127.0.0.1 -p 2222 -L3308:localhost:3306 
  </code></pre>
  
  <p>Then I can connect from host <code>mysql -h127.0.0.1 -P3308 -uroot -p</code> without problems, which I use as a temporary workaround.</p>