**解决django.db.utils.OperationalError: (1049, "Unknown database 'mydjango_db'")**

解决django.db.utils.OperationalError: (1049, “Unknown database ‘mydjango_db’”)

CMD:
#根据models.py生成相关的 .py 文件, 该文件用于创建数据表
D:\MyDjango>python manage.py makemigrations
Migrations for ‘index’:
index\migrations\0001_initial.py
-Create model product
#创建数据表
D:\MyDjango>python manage.py migrate

Error:
MySQLdb._exceptions.OperationalError: (1049, “Unknown database ‘mydjango_db’”)
django.db.utils.OperationalError: (1049, “Unknown database ‘mydjango_db’”)

解决方法:
‘MyDjango’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘mysql’,
‘USER’:‘root’,
‘PASSWORD’:‘123456’,
‘HOST’:‘127.0.0.1’,
‘port’:‘3306’,
},
将’NMAE’: 改为’mysql’
**解决django.db.utils.OperationalError: (1049,

你可能感兴趣的:(Django)