Authentication plugin 'caching_sha2_password' is not supported
Per Caching SHA-2 Pluggable Authentication
In MySQL 8.0,
caching_sha2_password
is the default authentication plugin rather thanmysql_native_password
.
You're using mysql_native_password
, which is no longer the default. Assuming you're using the correct connector for your version you need to specify the auth_plugin
argument when instantiating your connection object
cnx = mysql.connector.connect(user='lcherukuri', password='password',
host='127.0.0.1', database='test',
auth_plugin='mysql_native_password')
From those same docs:
The
connect()
method supports anauth_plugin
argument that can be used to force use of a particular plugin. For example, if the server is configured to usesha256_password
by default and you want to connect to an account that authenticates usingmysql_native_password
, either connect using SSL or specifyauth_plugin='mysql_native_password'
.
Repeated NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported tried the previous solutions to no avail
Try
pip uninstall mysql-connector-python
and
pip install mysql-connector-python
in windows command line window.
If it failed, try to
reconfigure
MySql server
from MySql installer
then choose Use Legacy Authentication Method (Retain MySql 5x Compatibility)
in Authentication Method
Reconfiguring MySql server
and reinstalling mysql connector python
had removed my error
caching sha2 password is not supported mysql
I managed to fix this. In the end I was using a version of python in Anaconda which just wouldn't install version 8.0.11 of the python connector, I managed to get 8.0.11 installed on my vanilla python 3.6.5 using windows PowerShell (in admin privileges) and using pip install MySQL-connector-python
(I think I also had to update pip from 9 to 10.
Authentication plugin 'caching_sha2_password' cannot be loaded
You can change the encryption of the user's password by altering the user with below Alter command :
ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY
'password';
OR
We can avoid this error by make it work with old password plugin:
First change the authentication plugin in my.cnf file for Linux / my.ini file in Windows:
[mysqld]
default_authentication_plugin=mysql_native_password
Restart the mysql server to take the changes in affect and try connecting via MySQL with any mysql client.
If still unable to connect and getting the below error:
Unable to load plugin 'caching_sha2_password'
It means your user needs the above plugin. So try creating new user with create user or grant command after changing default plugin. then new user need the native plugin and you will able to connect MySQL.
Thanks
Related Topics
How to Overcome Typeerror: Unhashable Type: 'List'
How to Round a Floating Point Number Up to a Certain Decimal Place
Typeerror: Can't Use a String Pattern on a Bytes-Like Object in Re.Findall()
How to Replace Only Part of the Match with Python Re.Sub
How to Fetch a Non-Ascii Url with Urlopen
Is Python's Sorted() Function Guaranteed to Be Stable
What Is the Performance Impact of Non-Unique Indexes in Pandas
What's the Best Way to Return Multiple Values from a Function
Pandas Column Access W/Column Names Containing Spaces
How to Install Python Opencv Through Conda
Split by Comma and Strip Whitespace in Python
Why Is "If Not Someobj:" Better Than "If Someobj == None:" in Python