mysql支持sha2吗,mysql不支持缓存sha2密码

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.

"Authentication plugin '{0}' is not supported".format(plugin_name))

mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported"

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

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

解决方案

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值