After the upgrade to MariaDB 10.6 the backend could
not connect to the database because MariaDB was
configured to listen only on IPv6 addresses:
bind-address = ::
See https://mariadb.com/kb/en/server-system-variables/#bind_address
That behavior is new in MariaDB 10.6.
In terminal
$ mysql -u -p<passwd> mythconverg
worked, but
$ mysql -h 127.0.0.1 -u mythtv -p<passwd> mythconverg
failed.
Note: the former command uses a socket, the latter uses tcp to connect
to the database.
Nevertheless, mythbackend should connect via linux socket
to the database, but this failed:
(TestDBconnection) Start up testing connections. DB localhost, BE , attempt
0, status dbAwake, Delay: 2000
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
1000 linkLocalOnly 0
(checkPort) PortChecker::checkPort(): socket state 1
(checkPort) PortChecker::checkPort(): socket state 0
(TestDBconnection) Start up testing connections. DB localhost, BE , attempt
1, status dbAwake, Delay: 2000
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
5000 linkLocalOnly 0
(checkPort) PortChecker::checkPort(): socket state 0
(checkPort) PortChecker::checkPort(): socket state 0
...
(TestDBconnection) Start up failure. host localhost, status dbAwakeFail
(FindDatabase) FindDatabase() - failed
(main) Failed to init MythContext.
(~MythContext) Exiting
I checked the source code, there are no more log entries provided.
The config.xml shows
<Host>localhost</Host>
so mythtv should use the socket, but failed.
After I corrected the error in the MariaDB configuration
to use IPv4 addresses:
bind-address = *
backend started and the log shows
(TestDBconnection) Start up testing connections. DB localhost, BE , attempt
0, status dbAwake, Delay: 2000
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
1000 linkLocalOnly 0
(checkPort) PortChecker::checkPort(): socket state 1
(checkPort) PortChecker::checkPort(): socket state 3
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
30000 linkLocalOnly 1
(FindDatabase) FindDatabase() - Success!
Thus, in this case connection to the database via socket works!
In both cases, the configured mysqld socket is provided by mariadb:
$ ls -la /run/mysqld/mysqld.sock
srwxrwxrwx 1 mysql mysql 0 Apr 9 18:56 /run/mysqld/mysqld.sock
Now my questions:
Why does a connection from mythtv to the database via socket fail
if the bind-address is not properly configured in MariaDB?
Why does the same connection work via commandline?
Is it related to Ubuntu only and works on other setups
using MariaDB 10.6 (and IPv4) ?
Roland
not connect to the database because MariaDB was
configured to listen only on IPv6 addresses:
bind-address = ::
See https://mariadb.com/kb/en/server-system-variables/#bind_address
That behavior is new in MariaDB 10.6.
In terminal
$ mysql -u -p<passwd> mythconverg
worked, but
$ mysql -h 127.0.0.1 -u mythtv -p<passwd> mythconverg
failed.
Note: the former command uses a socket, the latter uses tcp to connect
to the database.
Nevertheless, mythbackend should connect via linux socket
to the database, but this failed:
(TestDBconnection) Start up testing connections. DB localhost, BE , attempt
0, status dbAwake, Delay: 2000
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
1000 linkLocalOnly 0
(checkPort) PortChecker::checkPort(): socket state 1
(checkPort) PortChecker::checkPort(): socket state 0
(TestDBconnection) Start up testing connections. DB localhost, BE , attempt
1, status dbAwake, Delay: 2000
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
5000 linkLocalOnly 0
(checkPort) PortChecker::checkPort(): socket state 0
(checkPort) PortChecker::checkPort(): socket state 0
...
(TestDBconnection) Start up failure. host localhost, status dbAwakeFail
(FindDatabase) FindDatabase() - failed
(main) Failed to init MythContext.
(~MythContext) Exiting
I checked the source code, there are no more log entries provided.
The config.xml shows
<Host>localhost</Host>
so mythtv should use the socket, but failed.
After I corrected the error in the MariaDB configuration
to use IPv4 addresses:
bind-address = *
backend started and the log shows
(TestDBconnection) Start up testing connections. DB localhost, BE , attempt
0, status dbAwake, Delay: 2000
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
1000 linkLocalOnly 0
(checkPort) PortChecker::checkPort(): socket state 1
(checkPort) PortChecker::checkPort(): socket state 3
(checkPort) PortChecker::checkPort(): host localhost port 3306 timeLimit
30000 linkLocalOnly 1
(FindDatabase) FindDatabase() - Success!
Thus, in this case connection to the database via socket works!
In both cases, the configured mysqld socket is provided by mariadb:
$ ls -la /run/mysqld/mysqld.sock
srwxrwxrwx 1 mysql mysql 0 Apr 9 18:56 /run/mysqld/mysqld.sock
Now my questions:
Why does a connection from mythtv to the database via socket fail
if the bind-address is not properly configured in MariaDB?
Why does the same connection work via commandline?
Is it related to Ubuntu only and works on other setups
using MariaDB 10.6 (and IPv4) ?
Roland