[mythtv] [GitHub] Set the default DB port to 3306 instead of making '0' mean default. [MythTV/mythtv 859ad36]

Michael T. Dean mtdean at thirdcontact.com
Fri Apr 15 02:12:15 UTC 2011


On 04/14/2011 07:51 PM, Daniel Kristjansson wrote:
> On Thu, 2011-04-14 at 15:29 -0400, Michael T. Dean wrote:
>>> If DB port is set to anything other than 0 and the database host name is
>>> localhost, we presume that the user--for some reason--wants to try a
>>> TCP/IP connection to localhost, so we change the database host name to
>>> 127.0.0.1.  MySQL treats the localhost hostname specially and uses a
>>> socket connection, rather than a TCP/IP connection.  I'm guessing you
>>> haven't granted permissions allowing such a connection.
> Hmmm, on the mysql command line at least localhost:0 and 127.0.0.1:3306
> mean something completely different. The first uses lightning fast unix
> sockets to communicate directly with mysql and the other thunks all
> the RPC through TCP/IP.

Daniel, that's exactly what I'm saying.  We un-auto-correct MySQL's 
auto-correction.  If you specify localhost as a hostname on a *nix 
system, port is ignored and the connection is made via Unix sockets.

For some crazy reason, we have code in there that says, "Well, if you 
specify a port, then we'll force you to use the slow TCP/IP to 
127.0.0.1."  We ignore the specified hostname if they use localhost with 
any value for a port.

We just need to take that out.  If someone really wants to use TCP/IP 
for a connection to the MySQL server on the local host, they can specify 
a DBHostName of 127.0.0.1.  We shouldn't be changing the hostname on 
them.  And, when MySQL gets good IPv6 support, our code will break 
things, anyway.

I think that code should be removed, whether it fixes Robert's problem 
or not (though I'm confident it will).

Mike


More information about the mythtv-dev mailing list