title: pyodbc + MySQL + Windows: Data source name not found and no default driver specified
body: <p>I am trying to connect to MySQL 5.6 on a Windows Server 2008 R2 localhost with pyodbc. I used the full installation for the MySQL instance on the localhost, including the ODBC connector. I have it connecting to a remote SQL Server instance beautifully, but for the life of me I can't get it to connect to the local MySQL instance. I am using this <a href="http://www.connectionstrings.com/mysql-connector-odbc-5-2/" rel="noreferrer">guide from connectionstrings.com</a> as reference.</p>
  
  <p>Here's some code:</p>
  
  <pre><code>import pyodbc
  
  def create_mssql_conn():
      return pyodbc.connect(r'Driver={SQL Server};Server=MSSQLSRV;Database=ecomm;Trusted_Connection=yes;')
  
  def create_mysql_conn():
      return pyodbc.connect(r'Provider=MSDASQL;Driver={MySQL ODBC 5.6 UNICODE Driver};Server=127.0.0.1;Database=ecomm;User=root;Password=myP@$$w0rd;Option=3;')
  
  # conn = create_mssql_conn() # This one works
  conn = create_mysql_conn() # This one breaks
  cursor = conn.cursor()
  cursor.execute('SELECT * FROM inventory')
  
  while 1:
      row = cursor.fetchone()
      if not row:
          break
      print row
  </code></pre>
  
  <p>Here is the error:</p>
  
  <pre><code>pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
  </code></pre>
  
  <p>I tried everything from adding <code>Provider=MSDASQL;</code> to changing <code>ANSI</code> to <code>UNICODE</code> in the connection string. Any suggestions?</p>