title: SSH Tunnel for Python MySQLdb connection
body: <p>I tried creating a SSH tunnel using</p>
  
  <pre><code>ssh -L 3306:localhost:22 &lt;hostip&gt;
  </code></pre>
  
  <p>Then running my python script to connect via localhost</p>
  
  <pre><code>conn = MySQLdb.connect(host'localhost', port=3306, user='bob', passwd='na', db='test')
  </code></pre>
  
  <p>However, I receive the following error</p>
  
  <pre><code>(2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")
  </code></pre>
  
  <p>How can I make sure I'm hitting the correct host and not just some problem with the bind?</p>