该错误为django 连接数据库没有权限,解决办法是:
DROP DATABASE IF EXISTS `mydb`; CREATE DATABASE `mydb` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; USE 'mysql'; GRANT ALL PRIVILEGES ON mydb.* TO 'mydb_user'@'localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION; FLUSH PRIVILEGES;
然后修改你的django 项目设置:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mydb', 'USER': 'mydb_user', 'PASSWORD': 'your_password', 'HOST': '', 'PORT': '', } }