python system_error ai_generated true

django.db.migrations.exceptions.MigrationSchemaMissing: 无法创建django_migrations表(数据库为只读)

django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (database is read-only)

ID: python/django-migration-unapplied-error

其他格式: JSON · Markdown 中文 · English
80%修复率
82%置信度
0证据数
2024-08-30首次发现

版本兼容性

版本状态引入弃用备注
3.x active

根因分析

数据库用户没有创建表的权限,或数据库处于只读模式。

English

Database user lacks permission to create tables, or database is in read-only mode.

generic

解决方案

  1. 90% 成功率
    Grant necessary permissions to the database user: GRANT ALL ON database.* TO 'user'@'localhost'
  2. 85% 成功率
    Check database connection settings and ensure the user has write access.

无效尝试

常见但无效的做法:

  1. 80% 失败

    Does not solve permission issues; may still fail.

  2. 90% 失败

    Data loss; not a viable solution in production.