Solving – mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported

Solving – mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported is an error which occurs when mysql-connector causes a problem.

In this blog post, I am going to explain why the error is here and how to get rid of it without getting the error again. Also we are going to check out other solutions that may work for your particular case.

Explaining the Error : mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported

The error can happen to anyone if thet install mysql-connector instead of mysql-connector-python.

Bellow is an example of the error message. Your error message should look like something like this.

                                                                       #
File "C:\Users\User\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 supported
                                                                       #

Bellow we will describe how the error can be solved. With multiple possible solutions.

Solution 1 : uninstall mysql-connector

First, you should uninstall mysql-connector because it works on some devices but not on others.

You can do that by running the command bellow.

                                                                       #
pip uninstall mysql-connector
                                                                       #

Then you can remove mysql-connector-python using the command bellow.

                                                                       #
pip uninstall mysql-connector-python
                                                                       #

Now, let us run the final command in order to install mysql-connector-python.

                                                                       #
pip uninstall mysql-connector-python
                                                                       #

And finally, the error should be gone. If that is not the case, let us try the fixes bellow.

Solution 2 : try this command

If the solution above does not work, make sure to try this one.

You can use the following command to see your settings.

                                                                       #
select Host,User,plugin from mysql.user;
                                                                       #

replace USER ‘…’ with your own user.

                                                                       #
ALTER USER '...' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
ALTER USER '...' IDENTIFIED WITH mysql_native_password BY '{NewPassword}';
                                                                       #

The solutions above should be enough to solve the problem, if you like our effort make sure to consider donating to our Kofi account, there is a red button that you can use if you are feeling generous.

Summing-up

I hope this article has been helpful and helped you solve this error, the first solution should be enough and should work for Windows and Linux.

I hope you continue coding and learning Python, errors are part of the fun even when we hate them, cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/