Django:mysql:1045,“Access denied for user” [英] Django : mysql : 1045, "Access denied for user
问题描述
我现在正在远程站点上安装。
创建一个新的mysql数据库,并创建一个新的用户(someuser),并给予完整的赠款,如下所示 -
授予所有优先权。 'someuser'@'localhost'IDENTIFIED BY'somepassword'WITH GRANT OPTION;
我已经使用python manage.py syncdb同步数据库,并创建了正确的表。
我的settings.py有同样的用户。
但是,当我尝试通过应用程序登录用户,并且它碰到数据库时,我看到以下在日志中 -
(1045访问被拒绝为用户'someuser'@'localhost'(使用密码:YES))
我通过mysql登录(安装在与django相同的框上),并检查了资助并正确显示 -
为someuser @ localhost拨款
授予所有特权*。 * TO'someuser'@'localhost'由PASSWORD识别'* thesaltedpasswordOverHere'WITH GRANT OPTION
我不想使用root用户/密码为django,因为它似乎不是正确的方式。
任何可能是错误的指针?
对于名为foo_db的数据库,我这样做:
创建数据库foo_db;
创建由foo_password标识的用户foo_user;
授予所有foo_db。*到'foo_user'@'%';
刷新权限;
I have the whole setup working for months on my local computer.
I'm installing on a remote site now.
Created a fresh mysql DB, and created a new user ("someuser") and gave it complete grants, like so -
GRANT ALL PRIVILEGES ON . TO 'someuser'@'localhost' IDENTIFIED BY 'somepassword' WITH GRANT OPTION;
I have sync'd the db, using "python manage.py syncdb" and the correct tables were created. My settings.py has this same user.
But when I try to login a user through the application, and it hits the DB, I see the following in the logs -
(1045, "Access denied for user 'someuser'@'localhost' (using password: YES)")
I logged in through mysql (installed on the same box as django) and checked the grants and it correctly shows -
Grants for someuser@localhost
GRANT ALL PRIVILEGES ON * . * TO 'someuser'@'localhost' IDENTIFIED BY PASSWORD '*thesaltedpasswordOverHere' WITH GRANT OPTION
I don't want to use the root user/password for django, since it doesn't seem the correct way.
Any pointers as to what might be wrong ?
I do it like this for a database named foo_db:
create database foo_db;
create user foo_user identified by 'foo_password';
grant all on foo_db.* to 'foo_user'@'%';
flush privileges;
这篇关于Django:mysql:1045,“Access denied for user”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!