mysql.connector.errors.NotSupportedError |
Authentication plugin 'caching_sha2_password' is not supported
Hi friends, I am trying to make database connectivity through MySQL in Python. But, I got the following error while writing the following connectivity code:
import mysql.connector as mysql
con = mysql.connect(
host = 'localhost',
user = 'root',
passwd = 'yourRootPassword',
database = 'dbName',
port = 3306
)
print('Database connected successfully...')
con.close()
Error:
in get_auth_pluginAnd to solve the above problem use the following solutions:
raise errors.NotSupportedError(
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
Solution 1:
From MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password.
We are using mysql_native_password, which is no longer default from version of MySQL 8.0, and to make successfully connection through this MySQL version you need to pass an additional argument of auth_plugin as given blow:
-
-
import mysql.connector as mysql
con = mysql.connect(
host = 'localhost',
user = 'root',
passwd = 'yourRootPassword',
database = 'dbName',
auth_plugin = 'mysql_native_password',
port = 3306
)
print('Database connected successfully...')
con.close()
Solution 2:
If you have done the solution 1. And, still getting the same error because of automatically installed mysql-connector instead of mysql-connector-python
-
-
Run the command given below to solve this error.
pip install mysql-connector-python
If you got some installation problem at the time of installing mysql-connector-python use the following commands:
pip uninstall mysql-connector
pip uninstall mysql-connector-python
pip install mysql-connector-python
---
I hope you likable this nice post. Do not forget to share it together with your friends, the Sharing Button is below the post. Apart from this, if there's any downside within the intermediate, don't hesitate to request the Comment Box. we are going to be happy to help you.
I will continue to write more and more on this blog, so do not forget to make our blog BlogLearner as a bookmark (Ctrl + D) on your mobile or computer and subscribe to us to get all the posts in your email. Do not forget to share these posts, if you like it. You can facilitate us reach additional individuals by sharing it on social networking sites like Facebook or Twitter.
mysql.connector.errors.NotSupportedError |
#rrkksinha #bloglearner #authentication_plugin #mysql.connector.errors.NotSupportedError
No comments:
Post a Comment