不支持身份验证插件"caching_sha2_password" [英] Authentication plugin 'caching_sha2_password' is not supported

查看:741
本文介绍了不支持身份验证插件"caching_sha2_password"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python连接器连接到MySQL服务器.我用身份验证插件mysql_native_password创建了一个新用户lcherukuri.

I am trying to connect to a MySQL server with python connector. I created a new user lcherukuri with the authentication plugin mysql_native_password.

但是我得到了错误

mysql.connector.errors.NotSupportedError:不支持身份验证插件'caching_sha2_password'

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()

推荐答案

在MySQL 8.0中,caching_sha2_password是默认的身份验证插件,而不是mysql_native_password.

In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password.

您正在使用mysql_native_password,它不再是默认值.假设您使用的是您所用版本的正确连接器,则需要指定实例化连接对象时的auth_plugin参数

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')

来自相同的文档:

connect()方法支持一个auth_plugin参数,该参数可用于强制使用特定的插件.例如,如果服务器默认配置为使用sha256_password,并且您想连接到使用mysql_native_password进行身份验证的帐户,则可以使用SSL连接或指定auth_plugin='mysql_native_password'.

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'.

这篇关于不支持身份验证插件"caching_sha2_password"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆