Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#12343 closed (fixed) 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: UI/UX:


database_engine = 'mysql'

database_host = '/var/lib/mysql/mysql.sock'

other fields omitted for this ticket.

python 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 sfllaw 7 years ago.

Download all attachments as: .zip

Change History (11)

Changed 7 years ago by sfllaw

comment:1 Changed 7 years ago by sfllaw

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 6 years ago by russellm

  • Has patch set
  • milestone set to 1.2
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by russellm

  • Component changed from Uncategorized to

comment:4 Changed 6 years ago by ericholscher

  • 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 Changed 6 years ago by jacob

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 Changed 6 years ago by sfllaw

jacob: has the relevant information on host names. Neither IP addresses nor DNS registered names can have slashes in them.

comment:7 Changed 6 years ago by jacob

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 Changed 6 years ago by russellm

  • milestone changed from 1.2 to 1.3
  • Needs tests unset

Not critical for 1.2.

comment:9 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 5 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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