0

Can't connect my code to my MySQL DB due to the authentication plugin

I'm trying to connect my code to a newly installed MySQL DB. I am aware that on MySQL 8.X and above, the authentication type is set to sha2 by default and I've read that I need to "force" a different authentication plug-in (auth_plugin='mysql_native_password').

well... I did it but I still get the same error message:

"Authentication plugin '{0}' is not supported".format(plugin_name)) mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported

What else should I do?

Thanks

import mysql.connector as Sql


myDB = Sql.connect(
    host="localhost",
    user="dbadmin",
    password="myPassword",
    auth_plugin="mysql_native_password"
)


print(myDB)
RoyW
  • 65
  • 3
  • 10
  • Could this be your case? https://stackoverflow.com/a/53561512/771848 – alecxe May 03 '19 at 20:38
  • Well instead of specifying auth_plugin as `mysql_native_password` maybe use `caching_sha2_password` like the error suggests. Its a bit odd that it needs to be specified. What connector version do you have? – danblack May 03 '19 at 22:30

1 Answers1

-1

This indeed solved my issue:

I had the same problem and passing auth_plugin='mysql_native_password' did not work, 
because I accidentally installed mysql-connector instead of mysql-connector-python (via 
pip3). Just to leaving this here in case it helps someone.

Authentication plugin 'caching_sha2_password' is not supported

RoyW
  • 65
  • 3
  • 10