title: Python MySQLdb Connection Import Error
body: <p>I am trying to connect with db using the following code:</p>
  
  <pre><code>import MySQLdb
  
  db = MySQLdb.connect(host="localhost",    # your host, usually localhost
                       user="root",         # your username
                       passwd="root",  # your password
                       db="test101")        # name of the data base
  
  # you must create a Cursor object. It will let
  #  you execute all the queries you need
  cur = db.cursor()
  
  # Use all the SQL you like
  cur.execute("SELECT * FROM test1")
  
  # print all the first cell of all the rows
  for row in cur.fetchall():
      print row[0]
  
  db.close()
  </code></pre>
  
  <p>However, I am getting the following error message on the console:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\JRambo\workspace\DBConnection\src\DBConnection.py", line 6, in &lt;module&gt;
      import MySQLdb
    File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 19, in &lt;module&gt;
      import _mysql
  ImportError: DLL load failed: %1 is not a valid Win32 application.
  </code></pre>
  
  <p>I have followed the steps meticulously.
  <a href="https://stackoverflow.com/questions/372885/how-do-i-connect-to-a-mysql-database-in-python/622308#622308">How do I connect to a MySQL Database in Python?</a></p>