1. 程式人生 > >Unable to create the django_migrations table 遷移檔案時報錯

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;

當然一般也不能做這種授權操作,所以直接找老大嘍