title: Enable Python to Connect to MySQL via SSH Tunnelling
body: <p>I'm using <code>MySqldb</code> with Python 2.7 to allow Python to make connections to another MySQL server</p>
  
  <pre><code>import MySQLdb
  db = MySQLdb.connect(host="sql.domain.com",
       user="dev", 
        passwd="*******", 
        db="appdb")
  </code></pre>
  
  <p>Instead of connecting normally like this, how can the connection be made through a SSH tunnel using SSH key pairs? </p>
  
  <p>The SSH tunnel should ideally be opened by Python. The SSH tunnel host and the MySQL server are the same machine.</p>