title: Unable to connect Python to MySQL
body: <p>I'm using pycharm 2017 and SQL Server 2019 and my problem is I use this code:</p>
  <pre><code>import mysql.connector
  
  cnx = mysql.connector.connect(user='sa', password='pooria1376',
                                host='localhost',
                                database='pooriadb')
  cnx.close()
  </code></pre>
  <p>I see this error:</p>
  <pre><code>C:\Python34\python.exe C:/Users/LA/PycharmProjects/untitled/main
  Traceback (most recent call last):
    File &quot;C:\Python34\lib\site-packages\mysql\connector\network.py&quot;, line 509, in open_connection
      self.sock.connect(sockaddr)
  ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;C:/Users/LA/PycharmProjects/untitled/main&quot;, line 5, in &lt;module&gt;
      database='pooriadb')
    File &quot;C:\Python34\lib\site-packages\mysql\connector\__init__.py&quot;, line 179, in connect
      return MySQLConnection(*args, **kwargs)
    File &quot;C:\Python34\lib\site-packages\mysql\connector\connection.py&quot;, line 95, in __init__
      self.connect(**kwargs)
    File &quot;C:\Python34\lib\site-packages\mysql\connector\abstracts.py&quot;, line 716, in connect
      self._open_connection()
    File &quot;C:\Python34\lib\site-packages\mysql\connector\connection.py&quot;, line 206, in _open_connection
      self._socket.open_connection()
    File &quot;C:\Python34\lib\site-packages\mysql\connector\network.py&quot;, line 512, in open_connection
      errno=2003, values=(self.get_address(), _strioerror(err)))
  mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)
  
  Process finished with exit code 1
  </code></pre>
  <p>Also I disabled firewall , &quot;sa&quot; is default username of SQL Server and I'm sure my password is true (because I login with this information). Anyone can please help me?</p>