5

私はpythonの初心者で、mysqlデータベースに接続していくつかのことを行うサーバースクリプトを作成して、いくつかのことを学ぼうとしています。私はpython 3.3.1とmysql 5.0.96(コミュニティ)を持っています。mysql コネクタ/python をインストールし、mysql dev サイトのサンプル コードを使用して基本的な接続を試みました。ここに私の簡単な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

私は何を間違っていますか?どんな助けでも大歓迎です

4

1 に答える 1

3

MySQL は 2 つのパスワード暗号化方式をサポートしていますが、あなたの方式は古いレガシー バージョンを使用しています。新しいクライアントは、クラックするのが非常に簡単であるため、それらの使用を拒否します.

パスワードを新しいスタイルに更新する必要があります: http://dev.mysql.com/doc/refman/4.1/en/old-client.html

于 2013-04-10T17:22:05.767 に答える