+-

我试图用 python连接器连接到 MySQL服务器.我用身份验证插件mysql_native_password创建了一个新的用户lcherukuri.
但我得到了错误
mysql.connector.errors.NotSupportedError: Authentication plugin ‘caching_sha2_password’ is not supported
有人能帮我吗?
import mysql.connector
cnx = mysql.connector.connect(user='lcherukuri', password='password',
host='127.0.0.1',
database='test')
cnx.close()

最佳答案
每 Caching SHA-2 Pluggable Authentication
In MySQL 8.0,
caching_sha2_passwordis the default authentication plugin rather thanmysql_native_password.
您使用的是mysql_native_password,它不再是默认值.假设您正在使用correct connector for your version,则需要在实例化连接对象时指定the auth_plugin argument
cnx = mysql.connector.connect(user='lcherukuri', password='password',
host='127.0.0.1', database='test',
auth_plugin='mysql_native_password')
从那些相同的文档:
The
connect()method supports anauth_pluginargument that can be used to force use of a particular plugin. For example, if the server is configured to usesha256_passwordby default and you want to connect to an account that authenticates usingmysql_native_password, either connect using SSL or specifyauth_plugin='mysql_native_password'.
点击查看更多相关文章
转载注明原文:python – 不支持身份验证插件“caching_sha2_password” - 乐贴网