刚在django中settings.py进行设置mysql数据库。

当进行执行python manage.py shell命令时会报以下错误:

django中mysql数据库设置错误解决方法

只需要在settings.py中

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', //在这里把“mysql”修改成“django.db.backends.mysql”即可解决

'NAME': 'my_db',

'USER': 'root',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '3306', # Set to empty string for default.
}
}

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2021-08-04
  • 2022-01-17
  • 2022-12-23
  • 2021-12-03
  • 2021-07-28
  • 2022-12-23
猜你喜欢
  • 2021-07-18
  • 2021-12-04
  • 2021-12-13
  • 2021-04-27
  • 2022-01-01
  • 2021-11-23
相关资源
相似解决方案