[mythtv] MySQL Database connection through socket fails for MariaDB 10.6
Michael T. Dean
mtdean at thirdcontact.com
Tue Apr 12 12:24:08 UTC 2022
On 04/09/2022 01:55 PM, Roland Ernst wrote:
> Why does a connection from mythtv to the database via socket fail
> if the bind-address is not properly configured in MariaDB?
This was almost definitely due to how you specified your MythTV database
configuration.
MythTV makes some assumptions, based on what the user-specified database
configuration says, about how to connect to the database. It "always"
prefers to use socket/shared-memory connections since they're faster,
unless the user specifies something that implies they explicitly want to
use TCP/IP connections.
Specifically, if the database port is 0 (flag saying use MySQL default)
or 3306 (MySQL default) and the DB host name is 127.0.0.1, it will
ignore the specified-as-an-IP-address host name and use localhost for
the DB host name and connect using sockets/shared memory. Thus, the
"always" is only true with IPv4.
https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythbase/mythdbcon.cpp#L159
It's probably now time to update that conditional to take into account
the IPv6 equivalents of 127.0.0.1 (::1, 0:0:0:0:0:0:0:1, ...?). One
could probably even make an argument for handling 0.0.0.0 (and :: or
0:0:0:0:0:0:0:0), too, though it seems it's never been an issue so
far--or at least not enough of one to have caused much discussion.
Mike
More information about the mythtv-dev
mailing list