title: How to connect to MySQL via Standard TCP/IP over SSH using go-sql-driver?
body: <p>I'm currently using MySQL Workbench on Windows 8.1 to access a remote MySQL database on a Linux server using Standard TCP/IP over SSH. Basically I have the following information:</p>
  
  <ul>
  <li>SSH Hostname: dbserver.myorg.com:<em>ssh-port</em></li>
  <li>SSH Username: myRemoteLoginUsername</li>
  <li>SSH Password: (stored in vault)</li>
  <li><p>SSH Key File: <em>path to a local .ppk file</em></p></li>
  <li><p>MySQL Hostname: 127.0.0.1</p></li>
  <li>MySQL Server Port: 3306</li>
  <li>Username: myRemoteDbUsername</li>
  <li>Password: (stored in vault)</li>
  <li>Default schema: myRemoteDatabaseName</li>
  </ul>
  
  <p>How can I connect to the database from a Go command application using github.com/go-sql-driver/mysql?</p>
  
  <p>how should my DataSourceName string in the sql.Open statement look like?</p>
  
  <pre><code>    db, err := sql.Open("mysql", &lt;DataSourceName&gt; ) {}
  </code></pre>
  
  <p>Is there any extra work needed to prepare a working DataSourceName string? </p>
  
  <p>On my Windows PC I have putty installed. I read about tunneling and added a Dynamic tunnel for port 3306 (D3306). I expected this will let me connect using a connection to localhost:3306 and automatically forward the request to the remote db whenever I'm connected to the remote host with putty, but this didn't work as expected either.</p>