setting.py配置
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test2',
'USER':'root',
'PASSWORD':'root',
'HOST':'localhost',
'PORT':'3306'
}
}
执行迁移发生错误
django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'loca lhost'
解决办法:
将HOST字段改为127.0.0.1