Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #234 (closed task: fixed)

Opened 14 years ago

Last modified 12 years ago

Add MySQL socket information to the docs

Reported by: SuperJared <jared.kuolt@…> Owned by: SuperJared
Priority: normal Milestone: 0.9
Component: SQLObject Version:
Severity: normal Keywords:


From "citizenkahn":


I'd put this in a wiki, but I'm not sure where there is a Turbogears one.

Problem: I want to use turbo gears, but my machine is setup with mysql not bound to a network socket and I get the following errors when I try to connect: _mysql_exceptions.OperationalError?: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)");

Situation: There is a practice of not binding MySQL to an ip address and port following the principle that "if you're not connected, you are protected." In this situation, the server has a socket file. By default TurboGears (or SQLObject and the python MySQL driver/client to be more exact) will look for the socket file in /tmp/mysql.sock. Many installations seem to use /var/lib/mysql/mysql.sock. Therefore, to get TurboGears to work, you'll need to specify the unix_socket (if on unix) param in the dburi.

Format: sqlobject.dburi="mysql://username:password@localhost/databasename?unix_socket=path-to-mysql.sock"

Example: I have my socket file in /var/lib/mysql/mysql.sock and I want my user foo with password bar to connect to my db test1. sqlobject.dburi="mysql:/foo:bar@localhost/test1?unix_socket=/var/lib/mysql/mysql.sock"

Hope this helps.

Change History

comment:1 Changed 14 years ago by SuperJared <jared.kuolt@…>

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

Somewhat preliminarily done.

Note: See TracTickets for help on using tickets.