[mythtv] MySQL Database connection through socket fails for MariaDB 10.6

Roland Ernst rcrernst at gmail.com
Tue Apr 12 20:54:27 UTC 2022


On Tue, Apr 12, 2022 at 2:25 PM Michael T. Dean <mtdean at thirdcontact.com>
wrote:

> 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
>
>
>> This was almost definitely due to how you specified your MythTV database
>>  configuration.

I do not - fully - agree.
The configuration of MythTV worked for MariaDB 10.5, but does not work in
10.6.
Before MythTV actually tries to connect to the database,
it checks if a QTcpSocket can be established on the host ('localhost')
and the given port.
See the logs in the first post and
https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythbase/portchecker.cpp#L73

This check fails, because MariaDB is configured to use IPv6 only,
by 'bind-address = ::', the advised setting from the MythTVs wiki.
But, this behavior changed in MariaDB 10.6:
See https://mariadb.com/kb/en/server-system-variables/#bind_address

The setting of the 'bind-address=::' is advised by the MythTVs wiki for
IPv4, too.
Therefore, every user who upgraded to Ubuntu 22.04, using IPv4
and uses MariaDB and configured MythTV for multiple frontends,
will report the error, that the backend is not able to connect
to the database, anymore.
I expect troubles.
If this can be confirmed, we need to update the release notes,
the wiki related to mysql and do a 'heads-up' posting on the forum.

Roland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20220412/096ea61c/attachment.htm>


More information about the mythtv-dev mailing list