. Advertisement .
. Advertisement .
A problem shows mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported and interrupts us while running Java. This blog will see why it happens and how to solve it. Read it now!
What is “mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported” ?
We attempted to link a MySQL database to a Python connector through the mysql connector, however, encountered the following issue.
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
What causes error?
This could be the reason why you are getting this error:
– your Python connector does not support the caching_sha2_password authentication plugin, you need to update it.
– If you are using Anaconda, the error may be related to its environment.
– version not suitable
What Solutions Can We Use To Fix It?
To fix it, run the pip uninstall mysql-connector to remove it and replace it with mysql-connector-python by using pip install mysql-connector-python. It should correct the error. This will be the way to solve the error for you. Please continue to follow the detailed implementation steps below.
As instructed above, you should try to remove the mysql-connector using the pip uninstall mysql-connector command. After that, replace it with the python version by a simple pip install mysql-connector-python code, and it will solve your error. Here is instruction:
pip uninstall mysql-connector
pip install mysql-connector-python
Solution 2: For Anaconda
If you are using Anaconda, use the following command to update the mysql-connector-python module:
conda install -c anaconda mysql-connector-python
Assuming you have the right connector, you must include the auth plugin option when creating your connection object.
cnx = mysql.connector.connect(user='root', password='', host='127.0.0.1', database='airpaw', auth_plugin='mysql_native_password')
The connect() function accepts an auth plugin parameter, which you may use to impose the usage of a certain plugin. For instance, if the site is set to use the default password, you may want to link it with a native password.
MySQL 8.0 has made caching_sha2_password the default authentication for new accounts, it requires the connectors to be updated to be able to use it. Try the following code:
[mysqld] #add the following file to your MySQLd file default_authentication_plugin=mysql_native_password
We hope you appreciated our blog post about mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported. For questions or concerns about the content of this blog, please contact us at the discussion forum.
Thank you for reading. We are always excited when one of our posts can provide useful information on this topic!