title: Connecting to Azure SQL with Python
body: <p>I am trying to connect to a SQL Database hosted in Windows Azure through MySQLdb with Python. </p>
  
  <p>I keep getting an error mysql_exceptions.OperationalError: (2001, 'Bad connection string.')</p>
  
  <p>This information works when connecting through .NET (vb, C#) but I am definitely not having any luck here. </p>
  
  <p>For  below I used my server's name from azure then .database.windows.net   Is this the correct way to go about this?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#!/usr/bin/python
  import MySQLdb
  
  conn = MySQLdb.connect(host="&lt;servername&gt;.database.windows.net", user="myUsername", passwd="myPassword", db="db_name")
  
  cursor = conn.cursor()
  </code></pre>
  
  <p>I have also tried using pyodbc with FreeTDS with no luck.</p>