mysql不支持缓存sha2密码 [英] caching sha2 password is not supported mysql

查看:125
本文介绍了mysql不支持缓存sha2密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让我的python程序将数据插入MySQL,我遵循了指南,但是我仍然收到以下错误.

i'm trying to get my python program to insert data into MySQL and i followed a guide however i keep getting the error below.

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

"Authentication plugin '{0}' is not supported".format(plugin_name)) mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported"

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

have i missed a setting in mysql server or does python not support this yet?

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

I think i can just change the password type but mysql doesn't want to let me for some reason all users with caching_sha2_password can't be changed and when i create a new user and select SHA256 Password I get the error creating account @% the password hash doesn't have the expected format. check if the correct password algorithm is being used with the PASSWORD() function.

#!/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在我的香草python 3.6.5上安装了8.0.11(具有管理员权限)并使用pip install MySQL-connector-python(我想我还必须将点数从9更新为10.

I managed to fix this. In the end I was using a version of python in Anaconda which just wouldn't install version 8.0.11 of the python connector, I managed to get 8.0.11 installed on my vanilla python 3.6.5 using windows PowerShell (in admin privileges) and using pip install MySQL-connector-python (I think I also had to update pip from 9 to 10.

这篇关于mysql不支持缓存sha2密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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