django.db.utils.InternalError: (1698, "Access denied for user 'root'@'localhost'")

There was a problem deploying Django project on the server (running under Windows no problem at all)
specific problems for the implementation of python3 manage.py makemigrations the event, the
specific code section:

'ENGINE': 'django.db.backends.mysql',
        'NAME': "blog",
        'USER': 'root',
        'PASSWORD': '密码',
        'HOST': '127.0.0.1',
        'PORT': '3306',

I did not find the specific reason ( 猜测跟’USER’: 'root’有关), but found a solution, in particular in the mysql database to create a user and authorize it to him, to rootchange to the newly created user.
Specific operation is as follows:

create user '用户名'@'%' identified by '密码';  # 创建用户
grant all on *.* to '用户名'@'%';  # 授权
flush privileges;  # 刷新权限
Published 141 original articles · won praise 131 · views 210 000 +

Guess you like

Origin blog.csdn.net/qq_41621362/article/details/103075160