title: Python script unable to connect to MySQL db with no password
body: <p>I am having a weird issue with my python script. My script has to connect to MySQL DB. This is the code:</p>
  
  <pre><code>try:
     conn = MySQLdb.connect( user='root', host = 'localhost')
     cursor = conn.cursor()
     databases = cursor.fetchall()
     cursor.close()
  except Exception as e:
     print e
  </code></pre>
  
  <p>when I run this script I have and error like:</p>
  
  <pre><code>(1045, "Access denied for user 'root'@'localhost' (using password: NO")
  </code></pre>
  
  <p>in the other hand, I can connect to MySQL just by entering <code>MySQL</code> (without password). </p>
  
  <p>Why am I having this error with my python script when there is no password to root user?</p>