Opened 15 years ago

Closed 14 years ago

Last modified 13 years ago

#12343 closed (fixed)

manage.py dbshell fails to launch mysql for unix socket

Reported by: elyon001@… 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)

dbshell-over-socket.patch (561 bytes ) - added by Simon Law 15 years ago.

Download all attachments as: .zip

Change History (11)

by Simon Law, 15 years ago

Attachment: dbshell-over-socket.patch added

comment:1 by Simon Law, 15 years ago

Here's a simple patch that works for me. Socket detection should probably be better than just testing whether '/' is in the path.

comment:2 by Russell Keith-Magee, 15 years ago

Has patch: set
milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:3 by Russell Keith-Magee, 15 years ago

Component: Uncategorizeddjango-admin.py

comment:4 by Eric Holscher, 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 Jacob, 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 Simon Law, 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 Jacob, 15 years ago

Triage Stage: AcceptedReady for checkin

comment:8 by Russell Keith-Magee, 15 years ago

milestone: 1.21.3
Needs tests: unset

Not critical for 1.2.

comment:9 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [13663]) [1.2.X] Fixed #12343 -- Added support for connection-by-socket to MySQL using the dbshell management command. Thanks to elyon001@… for the report, and sfllaw for the patch.

Backport of r13660 from trunk.

comment:10 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top