Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
394 views
in Technique[技术] by (71.8m points)

python - caching sha2 password is not supported 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.

"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()
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...