美文网首页
python3,django生成MySQL8.0数据表迁移时出现

python3,django生成MySQL8.0数据表迁移时出现

作者: 感觉至上的Dreamer就是我 | 来源:发表于2018-08-18 16:22 被阅读0次

    事故情况:

    在models.py下写好数据后,settings.py中databases的设置为

    此时进行 python manage.py makemigrations操作,出现了

    解决办法:

    主要就是mysql8.0的问题。

    目前最新的mysql8.0对用户密码的加密方式为caching_sha2_password, django暂时还不支持这种新增的加密方式。只需要将用户加密方式改为老的加密方式即可。

    解决步骤:

    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服务器就没有任何问题了。

    相关文章

      网友评论

          本文标题:python3,django生成MySQL8.0数据表迁移时出现

          本文链接:https://www.haomeiwen.com/subject/enjjmftx.html