【发布时间】:2018-12-29 08:22:15
【问题描述】:
我正在尝试从 DJango 连接到 MySQL。 我的 settings.py 文件:
DATABASES = {
'default':{
'ENGINE': 'django.db.backends.mysql',
'Name': 'my_db',
'User': 'my_user',
'Password': 'my_pass',
'Host': 'localhost',
'Port': '3306'
}
}
}
我收到以下错误。
django.db.utils.OperationalError: (1045, u"Access denied for user 'my_user'@'localhost' (using password: NO)")
我已尝试以下步骤来解决问题。
我已经创建了用户:
create user 'my_user'@'localhost' identified by 'my_pass';
并按如下方式授予访问权限:
grant all on *.* to 'my_user'@'localhost';
flush privileges;
但是,即使我的问题还没有解决。 有人可以帮我吗?
谢谢。
【问题讨论】:
-
我在尝试解决方案后发布了这个问题。我已授予用户访问权限。但是,即使我遇到了同样的错误。
-
@ShankarMuthusamy 你是否能够使用 mysql 客户端使用上述凭据访问 mysql shell?
-
@RiteshAgrawal,是的,我可以使用凭据访问 mysql shell。
标签: mysql django django-mysql