[Django] #30088: host = 127.0.0.1 does not force TCP for MySQL driver

17 views
Skip to first unread message

Django

unread,
Jan 9, 2019, 9:46:26 AM1/9/19
to django-...@googlegroups.com
#30088: host = 127.0.0.1 does not force TCP for MySQL driver
-----------------------------------------+------------------------
Reporter: rvernica | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
For the MySQL driver if "host = 127.0.0.1" is set in the "my.cfg" file,
the driver should use the TCP protocol instead of a UNIX socket. This does
not work in Django.

To work around this "'HOST': '127.0.0.1'," has to be set in "DATABASES" in
"settings.py"

--
Ticket URL: <https://code.djangoproject.com/ticket/30088>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 9, 2019, 10:17:42 AM1/9/19
to django-...@googlegroups.com
#30088: host = 127.0.0.1 does not force TCP for MySQL driver
-------------------------------+--------------------------------------

Reporter: rvernica | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Simon Charette):

Not sure what's the issue here, setting `'HOST': '127.0.0.1'` in
`DATABASES[alias]` should be required to connect using to localhost though
TCP. Why you do consider it a workaround?

In other words, what would you expect `DATABASES` to be set to in order to
connect to your localhost MySQL instance through a TCP socket?

--
Ticket URL: <https://code.djangoproject.com/ticket/30088#comment:1>

Django

unread,
Jan 9, 2019, 5:15:55 PM1/9/19
to django-...@googlegroups.com
#30088: host = 127.0.0.1 does not force TCP for MySQL driver
-------------------------------------+-------------------------------------
Reporter: rvernica | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => needsinfo
* component: Uncategorized => Database layer (models, ORM)
* type: Uncategorized => Bug


--
Ticket URL: <https://code.djangoproject.com/ticket/30088#comment:2>

Django

unread,
Apr 11, 2019, 6:02:10 PM4/11/19
to django-...@googlegroups.com
#30088: host = 127.0.0.1 does not force TCP for MySQL driver
-------------------------------------+-------------------------------------
Reporter: rvernica | Owner: nobody
Type: Bug | Status: new

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by rvernica):

* status: closed => new
* resolution: needsinfo =>


Comment:

I would expect not to need to set `HOST` in `DATABASES` since
`host=127.0.0.1` is already set in `my.cfg`. Django does not honor
`127.0.0.1` in `my.cfg` and tries to connect using a UNIX socket instead
of TCP.

--
Ticket URL: <https://code.djangoproject.com/ticket/30088#comment:3>

Django

unread,
Apr 13, 2019, 8:54:23 AM4/13/19
to django-...@googlegroups.com
#30088: host = 127.0.0.1 does not force TCP for MySQL driver
-------------------------------------+-------------------------------------
Reporter: rvernica | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam (Chainz) Johnson):

* status: new => closed

* resolution: => invalid


Comment:

Hi,

Django is not doing anything in particular here. The underlying library
used is `mysqlclient`, and that itself uses the MySQL C bindings, which
has some default behaviour around checking configuration files. I think it
differs slightly from the MySQL command line and the `my.cfg` file may not
be checked.

If you still consider this a problem, try checking for similar issues in
mysqlclient or reporting it there: https://github.com/PyMySQL/mysqlclient-
python . But they are quite conservative as a project, so I'd say it's
unlikely anything will be done.

Thanks,

Adam

--
Ticket URL: <https://code.djangoproject.com/ticket/30088#comment:4>

Reply all
Reply to author
Forward
0 new messages