简体   繁体   中英

client does not support authentication protocol requested by server consider upgrading mysql client

I want to run python manage.py syncdb to build a database with Django. However, I get the following error:

client does not support authentication protocol requested by server consider upgrading mysql client

Then I do this: 在此处输入图片说明

It appears that FUNCTION mysql.old_password does not exist.

A section of Django setting.py :

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'blog_list',
        'USER': 'blog_listuser',
        'PASSWORD': '4cZbmXZyyHpAA0oT',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

I use Windows 7 and MySQL 5.7.10.

Here is a part of database log error:

2016-02-09T07:55:09.032900Z 0 [Note] InnoDB: Waiting for purge to start
2016-02-09T07:55:09.157700Z 0 [Note] InnoDB: Waiting for purge to start
2016-02-09T07:55:09.282500Z 0 [Note] InnoDB: 5.7.10 started; log sequence number 2536368
2016-02-09T07:55:09.282500Z 0 [Note] InnoDB: not started
2016-02-09T07:55:09.547701Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\mysql-5.7.10-win32\data\ib_buffer_pool
2016-02-09T07:55:15.616111Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 6381ms. The settings might not be optimal. (flushed=36 and evicted=0, during the time.)
2016-02-09T07:55:17.659715Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-02-09T07:55:17.690915Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160209 15:55:17
2016-02-09T07:55:18.985717Z 0 [Warning] System table 'plugin' is expected to be transactional.
2016-02-09T07:55:19.188518Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-02-09T07:55:19.219718Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-02-09T07:55:19.266518Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-02-09T07:55:19.266518Z 0 [Note] IPv6 is available.
2016-02-09T07:55:19.297718Z 0 [Note]   - '::' resolves to '::';
2016-02-09T07:55:19.360118Z 0 [Note] Server socket created on IP: '::'.
2016-02-09T07:55:19.547318Z 0 [Warning] Failed to open optimizer cost constant tables

2016-02-09T07:55:21.965322Z 0 [Warning] The plugin '*C6E2795BB700C59FE4A4A8E2559543B1AD0263D4' used to authenticate user 'blog_listuser'@'localhost' is not loaded. Nobody can currently login using this account.
2016-02-09T07:55:22.027723Z 0 [Warning] System table 'time_zone_leap_second' is expected to be transactional.
2016-02-09T07:55:22.027723Z 0 [Warning] System table 'time_zone_name' is expected to be transactional.
2016-02-09T07:55:22.027723Z 0 [Warning] System table 'time_zone' is expected to be transactional.
2016-02-09T07:55:22.027723Z 0 [Warning] System table 'time_zone_transition_type' is expected to be transactional.
2016-02-09T07:55:22.027723Z 0 [Warning] System table 'time_zone_transition' is expected to be transactional.
2016-02-09T07:55:22.090123Z 0 [Warning] System table 'servers' is expected to be transactional.
2016-02-09T07:55:36.317347Z 0 [ERROR] Incorrect definition of table mysql.db: expected column 'User' at position 2 to have type char(32), found type char(16).
2016-02-09T07:55:36.332948Z 0 [ERROR] mysql.user has no `Event_priv` column at position 28
2016-02-09T07:55:36.364148Z 0 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
2016-02-09T07:55:36.379748Z 0 [Note] MySQL: ready for connections.
Version: '5.7.10'  socket: ''  port: 3306  MySQL Community Server (GPL)
2016-02-09T09:13:27.113995Z 3 [Warning] The plugin 'mysql_old_password' used to authenticate user 'blog_listuser'@'localhost' is not loaded. Nobody can currently login using this account.
2016-02-09T09:13:27.361009Z 3 [Warning] System table 'servers' is expected to be transactional.
2016-02-09T12:30:51.052347Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 11551607ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)

Django doesn't automatically generate your database. You must create it first before syncing or migrating. Also, you need to install MySQLDB package on your python package list. But if you're using Python3 then I suggest you use PyMySQL then add these on your settings.py

import pymysql

pymysql.install_as_MySQLdb()

I had a similar issue, I fixed this by replacing import MySQLdb with

import pymysql
pymysql.install_as_MySQLdb()

in settings.py .

I am using MySQLdb version 1.2.5, PyMySQ version 0.9.2, Python 2.7 and Django 1.11.2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM