Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Connecting to database via Unix sockets [RSS Feed]

#1 Nov. 19, 2005 22:52:36

Ben B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Connecting to database via Unix sockets


Is it possible to get Django to connect to MySQL via a Unix socket file
rather than on a TCP/IP port? I know that MySQLdb supports it, so I
expect it's just a case of changing the way MySQLdb is called. If no
one has done this before then I'll do it myself and submit a patch.

Ben

Offline

#2 Nov. 20, 2005 04:48:42

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Connecting to database via Unix sockets


On 11/19/05, Ben Butler-Cole <> wrote:
> Is it possible to get Django to connect to MySQL via a Unix socket file
> rather than on a TCP/IP port? I know that MySQLdb supports it, so I
> expect it's just a case of changing the way MySQLdb is called. If no
> one has done this before then I'll do it myself and submit a patch.

Nobody has brought this up before, and it sounds like it's just a case
of changing the MySQLdb call. Check out
django/core/db/backends/mysql.py.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Nov. 20, 2005 18:02:29

Ben B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Connecting to database via Unix sockets


Thanks for the pointer. It turns out that MySQLdb uses sockets by
default if you specify 'localhost' as the server. That's fine for my
purposes because my server is listening on the default. If anyone has
MySQL listening on another socket file then Django will need to be a
bit more configurable.

If you're using all the defaults it's sufficient to leave DATABASE_HOST
and DATABASE_PORT as empty strings.

Ben

Offline

  • Root
  • » Django
  • » Connecting to database via Unix sockets [RSS Feed]

Board footer

Moderator control

Enjoy the 27th of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support