0
import mysql.connector

mydb = mysql.connector.connect(

    host="localhost",
    user="root",
    password="henry123test",
    )

This was the error returned

mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported.

Can anyone help me, been googling for some time now.

Timus
  • 10,974
  • 5
  • 14
  • 28
  • 1
    Does this answer your question? [Authentication plugin 'caching\_sha2\_password' cannot be loaded](https://stackoverflow.com/questions/49194719/authentication-plugin-caching-sha2-password-cannot-be-loaded) – sushanth Nov 03 '20 at 11:00
  • 5
    This error is typical if you installed the deprecated `mysql-connector` and not `mysql-connector-python`. – Klaus D. Nov 03 '20 at 11:01
  • @KlausD. Thanks for clarifying, I just installed mysql-connector-python and it worked! – Jamike Michel Ohia Nov 03 '20 at 11:10

3 Answers3

0

/////first uninstall by

            pip uninstall mysql-connector-python

////then install

            pip install mysql-connector-python

/////to check rather its working or not, some code in python

import mysql.connector as connector

try:

con = connector.connect(database='DATABASENAME', host='HOSTNAME', port='3306',
                    user='root', password= 'PASSWORD')

print(con)

print ("Cursor is found")

except:

print ("Cursor is not found") `

////// MORE CMD FOR SQL

sql command for show databases -> show databases;

sql command for use database -> use databaseNAME;

sql command for create -> -> create database NAME;

sql command for status -> -> status;

enter image description here

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 25 '23 at 18:12
-1

usethis without end dot your problem wil be solved pip3 install mysql-connector-python

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 14 '22 at 19:21
  • 1
    This was already suggested [here](https://stackoverflow.com/a/67086525/18145256). – rachwa Jul 16 '22 at 07:18
-2

You can try: pip3 install mysql-connector-python

rachwa
  • 1,805
  • 1
  • 14
  • 17