Python MySQL Connector: caching_sha2_password plugin

10,172

Solution 1

I got the same issue and answers in this thread doesn't work for me. In case you want to solve in my way, download Older version of MySQL and you can avoid this error.

For Mac and Windows Link

Solution 2

You should add this to your connection argument: auth_plugin='mysql_native_password', this will force the connection to use the native plugin instead of the SHA2 plugin.

Share:
10,172
MJA
Author by

MJA

Updated on July 13, 2022

Comments

  • MJA
    MJA almost 2 years

    I am trying to connect to MySQL (8.0.11) from Python (3.6) on Windows 7 with the following code:

    import mysql.connector
    from mysql.connector import errorcode
    
    try:
      cnx = mysql.connector.connect(user='root', password='*****',
                                    database='test')
    except mysql.connector.Error as err:
        print(err)
    else:
      cnx.close()
    

    However i get following error message:

    Authentication plugin 'caching_sha2_password' is not supported

    How can i avoid this error?

    • hassanzadeh.sd
      hassanzadeh.sd about 4 years
      ` pip install --user mysql-connector-python`
  • Samar Pratap Singh
    Samar Pratap Singh over 3 years
    I am having mysql-connector-python==8.0.21 and mysql==8.0.21 ye the caching_sha2_password error is occurring in python==3.8.3.