[英]password error connecting to mysql database with python 3.3.1
我是python的新手,試圖通過編寫連接到我們的mysql數據庫的服務器腳本來學習一些東西並做一些事情。 我有python 3.3.1和mysql 5.0.96(社區)。 我安裝了mysql connector / python,並嘗試使用mysql開發站點上的示例代碼進行基本連接。 這是我簡單的python腳本:
#!/usr/local/bin/python3
import sys
import mysql.connector
db_config = {
'user': 'joebloggs',
'password': 'cleartext_passwd',
'host': '127.0.0.1',
'database': 'mydb'
}
cnx = mysql.connector.connect(**db_config)
cursor = cnx.cursor()
query = ('select usable_name, user_id from user')
cursor.execute(query)
for (usable_name, user_id) in cursor:
print("{} is the usable name of {d}".format(usable_name, user_id))
cursor.close()
cnx.close()
但我收到連接到數據庫的錯誤
"Authentication with old (insecure) passwords "\
mysql.connector.errors.NotSupportedError: Authentication with old (insecure) passwords is not supported. For more information, lookup Password Hashing in the latest MySQL manual
我究竟做錯了什么? 任何幫助非常感謝
MySQL支持兩種密碼加密方案,您的使用舊的舊版本。 較新的客戶拒絕使用它們,因為它們非常容易破解。
您需要將密碼更新為新樣式: http : //dev.mysql.com/doc/refman/4.1/en/old-client.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.