title: Connection of database using PyMySQL in Python 3.x
body: <p>Getting connection error in PyMYSQL:  </p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='pymysql')
  AttributeError: 'module' object has no attribute 'connect'
  </code></pre>
  
  <p><strong>code</strong></p>
  
  <pre><code>import pymysql
  
  conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='pymysql')
  
  cur = conn.cursor()
  
  cur.execute("SELECT Host,User FROM user")
  
  print(cur.description)
  
  print()
  
  for row in cur:
     print(row)
  
  cur.close()
  conn.close()
  </code></pre>