Python MySQL Connector: Caching_Sha2_Password Plugin

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 than mysql_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 an auth_plugin argument that can be used to force use of a particular plugin. For example, if the server is configured to use sha256_password by default and you want to connect to an account that authenticates using mysql_native_password, either connect using SSL or specify auth_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.

Mysql database not connecting to python

It seems that your MySQL Server version is 8.x and in that case the default MySQL connector is caching_sha2_password. In the other hand your error is maybe because your python client connector does not support this Authentication Plugin and you should explicitly change the Authentication Plugin to the old one (mysql_native_password).

cnx = mysql.connector.connect(user='root', password='password',
host='127.0.0.1', database='db',
auth_plugin='mysql_native_password')


Related Topics



Leave a reply



Submit