Unable to create the django_migrations table 迁移文件时报错

执行python manage.py makemigrations 报错:

raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1142, "CREATE command denied to user 'bi_r'@'10.173.29.181' for table 'django_migrations'"))


原因:

当前连接数据库的用户没有schema的create权限

解决办法:

进入数据库中,执行授权命令,给该用户授权:

grant usage on schema public to username;
grant create on schema public to username;

当然一般也不能做这种授权操作,所以直接找老大喽


你可能感兴趣的:(django)