执行python manage.py makemigrations生成迁移文件的时候,报错
问题所在:主要就是mysql8.0的问题。
目前最新的mysql8.0对用户密码的加密方式为caching_sha2_password, django暂时还不支持这种新增的加密方式。只需要将用户加密方式改为老的加密方式即可。
解决方案:
以下命令是在cmd窗口下完成的。
1.登录mysql,连接用户为root。
> mysql -u root -p
2.执行命令查看加密方式
> use mysql;
> select user,plugin from user where user='root';
3.执行命令修改加密方式
> alter user 'root'@'localhost' identified with mysql_native_password by 'yourpassword'
4.属性权限使配置生效
> flush privileges
重设mysql8.0的加密方式后,再次启动django服务器就没有任何问题了。
————————————————
原文链接:https://blog.csdn.net/qq_34809033/article/details/80928178