#12343 closed (fixed)
manage.py dbshell fails to launch mysql for unix socket
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.1 |
Severity: | Keywords: | dbshell mysql | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
settings.py
database_engine = 'mysql'
database_host = '/var/lib/mysql/mysql.sock'
other fields omitted for this ticket.
python manage.py dbshell ERROR 2005 (HY000): Unknown MySQL server host '/var/lib/mysql/mysql.sock' (1)
mysql -u root -h /var/lib/mysql/mysql.sock ERROR 2005 (HY000): Unknown MySQL server host '/var/lib/mysql/mysql.sock' (1)
The socket file for connection is specified with the -S option of mysql executable
django is able to connect to the database normally and created my tables via syncdb, admin app can see my tables.
>>> import django >>> django.VERSION (1, 1, 1, 'final', 0) >>> print sys.version 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
Attachments (1)
Change History (11)
by , 15 years ago
Attachment: | dbshell-over-socket.patch added |
---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Has patch: | set |
---|---|
milestone: | → 1.2 |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 15 years ago
Component: | Uncategorized → django-admin.py |
---|
comment:4 by , 15 years ago
Needs tests: | set |
---|
Seems like this could use a regression test, so that we make sure this continues to work in the future.
comment:5 by , 15 years ago
I'm not sure I like this "magic switch on /" behavior. Are there any circumstances in which a network host could contain a /? If so, we need a different patch. Or just punt it: dbshell
's a convenience, that's all.
comment:6 by , 15 years ago
jacob: http://tools.ietf.org/html/rfc3986#section-3.2.2 has the relevant information on host names. Neither IP addresses nor DNS registered names can have slashes in them.
comment:7 by , 15 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:9 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Here's a simple patch that works for me. Socket detection should probably be better than just testing whether '/' is in the path.