i'm a newbie to python, trying to learn some stuff by writing server scripts which connect to our mysql databases and do some stuff. i have python 3.3.1, and mysql 5.0.96 (community). i installed the mysql connector/python, and tried to do a basic connection using the sample code on the mysql dev site. here is my simple python script:
#!/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()
but i am getting an error connecting to the database
"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
what am i doing wrong? any help greatly appreciated
MySQL supports two password encryption schemes, and yours are using the old legacy version. Newer clients refuse to use those as they're pretty trivial to crack.
You need to update your passwords to the new style: http://dev.mysql.com/doc/refman/4.1/en/old-client.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With