加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – mysql不支持缓存sha2密码

发布时间:2020-12-20 13:00:28 所属栏目:Python 来源:网络整理
导读:我正在尝试让我的 python程序将数据插入 MySQL,我遵循指南,但我不断收到以下错误. “不支持身份验证插件”{0}“”.format(plugin_name)) mysql.connector.errors.NotSupportedError:不支持身份验证插件’caching_sha2_password’ 我错过了mysql服务器中的设
我正在尝试让我的 python程序将数据插入 MySQL,我遵循指南,但我不断收到以下错误.

“不支持身份验证插件”{0}“”.format(plugin_name))
mysql.connector.errors.NotSupportedError:不支持身份验证插件’caching_sha2_password’

我错过了mysql服务器中的设置还是python不支持这个?

我想我可以改变密码类型,但是mysql不想让我因为某些原因而无法更改所有使用caching_sha2_password的用户,当我创建新用户并选择SHA256密码时,我会收到错误创建帐户@%the密码哈希没有预期的格式.检查PASSWORD()函数是否使用了正确的密码算法.

#!/user
# -*- coding: utf-8 -*-

from __future__ import print_function
import urllib.request
import numpy as np
import mysql.connector as mysql

from datetime import date,datetime,timedelta



cnx = mysql.connect(user='root',password='password',database='powergrid')

cursor = cnx.cursor()

tomorrow = datetime.now().date() + timedelta(days=1)

idfueltype= cursor.lastrowid

add_fueltype = ("INSERT INTO fueltype"
                "(idfueltype,fueltypecol,demand)"
               "VALUES(%s,%s,%s)")

fueltype_data = (idfueltype,'coal',10000)

cursor.execute(add_fueltype,fueltype_data)

cnx.commit()

cursor.close()
cnx.close()

解决方法

我设法解决了这个问题.最后我在Anaconda中使用了一个版本的python,它不会安装python连接器的8.0.11版本,我设法使用Windows PowerShell在我的vanilla python 3.6.5上安装8.0.11(在管理员权限中)并使用pip install MySQL-connector-python(我想我也必须将pip从9更新到10.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读