title: Python MySQL connecting to database error
body: <p>I'm trying to create a small app with Python and MySQL.
  I managed to connect Python and MySQL using the MySQL connection. But now when I try to run this script to actually connect to the database:</p>
  
  <pre><code>import mysql.connector
  
  mydb = mysql.connector.connect(
      passwd="12345", 
      db="DB", 
      host="hostname", 
      user="root"
      )
  print(mydb)
  </code></pre>
  
  <p>I get a lot of errors like:</p>
  
  <pre><code> File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\network.py", line 485, in open_connection
  socket.SOL_TCP)
  
  File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 748, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno 11001] getaddrinfo failed
  File "c:/Users/Krystian/Desktop/DB/db.py", line 7, in &lt;module&gt;
      user="root"
  
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\__init__.py", line 179, in connect
      return MySQLConnection(*args, **kwargs)
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\connection.py", line 94, in __init__
      self.connect(**kwargs)
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\abstracts.py", line 722, in connect
      self._open_connection()
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\connection.py", line 207, in _open_connection
      self._socket.open_connection()
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\network.py", line 501, in open_connection
      errno=2003, values=(self.get_address(), _strioerror(err)))
  mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'hostname:3306' (11001 getaddrinfo failed)
  </code></pre>
  
  <p>I tried other ways of conecting to Database but they didn't work and I'm not really sure what to do now. </p>
  
  <p>Thanks in advance for any help!</p>
  
  <p>EDIT1 </p>
  
  <p>As <em>Juergen</em> mentioned, after fixing the hostname most of the errors above are gone, but new ones showed up:</p>
  
  <pre><code>File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\connection.py", line 94, in __init__
      self.connect(**kwargs)
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\abstracts.py", line 722, in connect
      self._open_connection()
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\connection.py", line 211, in _open_connection
      self._ssl)
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\connection.py", line 141, in _do_auth
      auth_plugin=self._auth_plugin)
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\protocol.py", line 102, in make_auth
      auth_data, ssl_enabled)
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\protocol.py", line 58, in _auth_response
      auth = get_auth_plugin(auth_plugin)(
    File "C:\Users\Krystian\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\authentication.py", line 191, in get_auth_plugin
      "Authentication plugin '{0}' is not supported".format(plugin_name))
  mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supporte
  </code></pre>