Opened 5 years ago
Last modified 5 years ago
#31491 closed Cleanup/optimization
dbshell command for MySQL backend uses "passwd" instead of "password". — at Version 8
Reported by: | Maruti N Sharma | Owned by: | Maruti N Sharma |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | dbshell, db, command-line |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
For MySql, "passwd" has been replaced with "password" long time ago, please check here https://code.djangoproject.com/ticket/5024
But dbshell command still looks for "passwd" key in the settings for db password, resulting in connection error.
This behaviour is also slightly different than other back-ends.
Pull request submitted: https://github.com/django/django/pull/12763
Steps to reproduce:
- create a new django project, set env
- choose mysql as db back-end
- specify db setting as following (ref: https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-DATABASES)
# use actual db username, password etc DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mydatabase', 'USER': 'mydatabaseuser', 'PASSWORD': 'mypassword', 'HOST': '127.0.0.1', 'PORT': '5432', } }
- Open a terminal and activate respective environment
- run: python manage.py dbshell
- You should get following error: Access denied for user 'mydatabaseuser'@'localhost' (using password: NO)
(My apologies for any mistake, I am new to bug-tracking system)
Change History (9)
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 5 years ago
Description: | modified (diff) |
---|
by , 5 years ago
Attachment: | ticket_31491.diff added |
---|
comment:3 by , 5 years ago
Description: | modified (diff) |
---|---|
Has patch: | set |
follow-up: 6 comment:4 by , 5 years ago
Easy pickings: | set |
---|---|
Summary: | "dbshell" command for MySql back-end uses "passwd" instead of "password" → dbshell command for MySQL backend uses "passwd" instead of "password". |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
Version: | 3.0 → master |
passwd
from OPTIONS
is passed to a --password
argument so it shouldn't cause any connection failures. However I agree that we can unify this. We can add a small release note (even if it's not documented). Please send patch via GitHub.
comment:5 by , 5 years ago
Description: | modified (diff) |
---|
comment:6 by , 5 years ago
Replying to felixxm:
passwd
fromOPTIONS
is passed to a--password
argument so it shouldn't cause any connection failures. However I agree that we can unify this. We can add a small release note (even if it's not documented). Please send patch via GitHub.
I understand that, actually I was using "OPTIONS" field for database settings, that is where this caused issue on my end.
If you wish to unify this behaviour, I have submitted the pull request.
comment:7 by , 5 years ago
Description: | modified (diff) |
---|
comment:8 by , 5 years ago
Description: | modified (diff) |
---|
patch file