title: Python 3 pymysql Database Access - Connecting to Database getting following error
body: <p>Can anyone help me on this issue while connecting DB over the python 3.5. following error receiving.</p>
  
  <pre><code>import pymysql
  
  # Open database connection
  db = pymysql.connect("localhost","testuser","test123","TESTDB", )
  
  # prepare a cursor object using cursor() method
  cursor = db.cursor()
  
  # execute SQL query using execute() method.
  cursor.execute("SELECT VERSION()")
  
  # Fetch a single row using fetchone() method.
  data = cursor.fetchone()
  
  print ("Database version : %s " % data)
  
  # disconnect from server
  db.close()
  </code></pre>
  
  <p>Errors:</p>
  
  <blockquote>
    <p>RESTART: C:/Program Files (x86)/Python35-32/db_connect.py 
    Traceback (most recent call last):
      File "C:\Program Files (x86)\Python35-32\lib\site-packages\pymysql-0.7.11-py3.5.egg\pymysql\connections.py", line 916, in connect
        <code>**kwargs</code>)
      File "C:\Program Files (x86)\Python35-32\lib\socket.py", line 712, in <code>create_connection</code>
        <code>raise err</code>
      File "C:\Program Files (x86)\Python35-32\lib\socket.py", line 703, in <code>create_connection</code>
        <code>sock.connect(sa)</code>
    ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it</p>
  </blockquote>
  
  <p>During handling of the above exception, another exception occurred:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "C:/Program Files (x86)/Python35-32/db_connect.py", line 4, in 
        <code>db = pymysql.connect("localhost","testuser","test123","TESTDB", )</code>
      File "C:\Program Files (x86)\Python35-32\lib\site-packages\pymysql-0.7.11-py3.5.egg\pymysql__init__.py", line 90, in Connect
        <code>return Connection(*args, **kwargs)</code>
      File "C:\Program Files (x86)\Python35-32\lib\site-packages\pymysql-0.7.11-py3.5.egg\pymysql\connections.py", line 706, in __ init __
        <code>self.connect()</code>
      File "C:\Program Files (x86)\Python35-32\lib\site-packages\pymysql-0.7.11-py3.5.egg\pymysql\connections.py", line 963, in connect
        <code>raise exc</code>
    pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([WinError 10061] No connection could be made because the target machine actively refused it)")</p>
  </blockquote>