[Solved] Can't Connection to DB (mythtv not linking to libQt5Sql)

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
noyez
Newcomer
Posts: 5
Joined: Thu Dec 27, 2018 4:16 am
Italy

[Solved] Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by noyez » Thu Dec 27, 2018 4:49 am

This has been driving me nuts and i'm at a loss, so any clues wouldn't be greatly appreciated.

The problem is that i cannot connect to the DB. This problem seems similar to the post entitled "can't connect to database after updating from 0.28 to 0.29" (i can't seem to link directly to the post), but i don't think it is the same solution.

If i run mythtv-setup.real, i see the following error message:

Code: Select all

2018-12-26 23:20:25.673000 E  DB Error (StorageGroup::StorageGroup()):
Query was:

Driver error was [1/-1]:
Driver not loaded
Database error was:
Driver not loaded
I can connect to the DB via mysql command line client (so the the DB is running).

Code: Select all

mythtv@myth ~ % mysql -N --host=localhost --user=mythtv --password=pass mythconverg '--execute=SELECT * FROM settings LIMIT 1;'
+------------------------------+----------------------+------+
| mythfilldatabaseLastRunStart | 2018-12-17T18:53:11Z | NULL |
+------------------------------+----------------------+------+
mythtv@myth ~ % mysql -N --host=192.168.1.3 --user=mythtv --password=pass mythconverg '--execute=SELECT * FROM settings LIMIT 1;'
+------------------------------+----------------------+------+
| mythfilldatabaseLastRunStart | 2018-12-17T18:53:11Z | NULL |
+------------------------------+----------------------+------+
I even wrote a sample QT program to test that the QT5 MySql driver was installed, and the following QT Sql Drivers appear to be installed QMYSQL being one of them.

Code: Select all

QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3
When i check the libraries used for the mythtv executables, only sqlite appears. I'd expect to see libQt5Sql.

Code: Select all

mythtv@myth ~ % ldd =mythtv-setup.real|grep sql
        libsqlite3 => /usr/lib/x86_64-linux-gnu/libsqlite3 (0x00007f1563fe2000)
mythtv@myth ~ % ldd =mythfrontend.real|grep sql
        libsqlite3 => /usr/lib/x86_64-linux-gnu/libsqlite3 (0x00007fa0ce400000)

Reference Info for my system:

Code: Select all

mythbuntu 18.04

Code: Select all

mariaDB: 10.2

Code: Select all

mythtv@myth ~ % mythutil --version
Please attach all output as a file in bug reports.
MythTV Version : v29.1
MythTV Branch :
Network Protocol : 91
Library API : 29.20180316-1
QT Version : 5.9.5
Options compiled in:
 linux profile use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_crystalhd using_dvb using_firewire using_frontend using_hdhomerun using_vbox using_ceton using_hdpvr using_ivtv using_joystick_menu using_libcec using_libcrypto using_libdns_sd using_libfftw3 using_libxml2 using_lirc using_mheg using_opengl using_opengl_video using_opengl_themepainter using_qtwebkit using_qtscript using_qtdbus using_taglib using_v4l2 using_x11 using_xrandr using_xv using_profiletype using_systemd_notify using_systemd_journal using_bindings_perl using_bindings_python using_bindings_php using_freetype2 using_mythtranscode using_opengl using_vaapi using_vdpau using_ffmpeg_threads using_mheg using_libass using_libxml2 using_libmp3lame

User avatar
paulh
Developer
Posts: 390
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by paulh » Thu Dec 27, 2018 12:00 pm

noyez wrote:
Thu Dec 27, 2018 4:49 am
When i check the libraries used for the mythtv executables, only sqlite appears. I'd expect to see libQt5Sql.

Code: Select all

mythtv@myth ~ % ldd =mythtv-setup.real|grep sql
        libsqlite3 => /usr/lib/x86_64-linux-gnu/libsqlite3 (0x00007f1563fe2000)
mythtv@myth ~ % ldd =mythfrontend.real|grep sql
        libsqlite3 => /usr/lib/x86_64-linux-gnu/libsqlite3 (0x00007fa0ce400000)
This may be a red herring since by default grep is cause sensitive. Try this instead

Code: Select all

$ ldd =mythtv-setup.real | grep -i sql
        libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f3bcf572000)
        libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f3bc3c7d000)

noyez
Newcomer
Posts: 5
Joined: Thu Dec 27, 2018 4:16 am
Italy

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by noyez » Thu Dec 27, 2018 1:42 pm

paulh wrote:
Thu Dec 27, 2018 12:00 pm

This may be a red herring since by default grep is cause sensitive. Try this instead

Code: Select all

$ ldd =mythtv-setup.real | grep -i sql
        libQt5Sql => /usr/lib/x86_64-linux-gnu/libQt5Sql (0x00007f3bcf572000)
        libsqlite3 => /usr/lib/x86_64-linux-gnu/libsqlite3 (0x00007f3bc3c7d000)
Wow, (Facepalm), you're totally right! i usually have grep aliased to always include that switch, but not on my mythtv machine.

Code: Select all

mythtv@myth ~ % ldd =mythtv-setup.real|grep -i sql
        libQt5Sql=> /usr/lib/x86_64-linux-gnu/libQt5Sql (0x00007f5a6383e000)
        libsqlite3 => /usr/lib/x86_64-linux-gnu/libsqlite3 (0x00007f5a512f2000)
        
Ok, so it is linking to sql, but the symptom still persists, i pasted the full output of mythtv-setup in case there's something else in there that i'm missing.

Code: Select all

mythtv@myth ~ % DISPLAY=:0 mythtv-setup.real
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-mythtv'
2018-12-27 08:38:04.544426 I  Setup Interrupt handler
2018-12-27 08:38:04.544450 I  Setup Terminated handler
2018-12-27 08:38:04.544456 I  Setup Segmentation fault handler
2018-12-27 08:38:04.544463 I  Setup Aborted handler
2018-12-27 08:38:04.544469 I  Setup Bus error handler
2018-12-27 08:38:04.544476 I  Setup Floating point exception handler
2018-12-27 08:38:04.544481 I  Setup Illegal instruction handler
2018-12-27 08:38:04.544490 I  Setup Real-time signal 0 handler
2018-12-27 08:38:04.544496 I  Setup Hangup handler
2018-12-27 08:38:04.544586 C  mythtv-setup version:  [v29.1]
2018-12-27 08:38:04.544592 C  Qt version: compile: 5.9.5, runtime: 5.9.5
2018-12-27 08:38:04.544598 N  Enabled verbose msgs:  general
2018-12-27 08:38:04.544609 N  Setting Log Level to LOG_INFO
2018-12-27 08:38:04.555870 I  Added logging to the console
2018-12-27 08:38:04.761927 N  Using runtime prefix = /usr
2018-12-27 08:38:04.761938 N  Using configuration directory = /home/mythtv/.mythtv
2018-12-27 08:38:04.762093 I  Assumed character encoding: en_US.UTF-8
2018-12-27 08:38:04.762784 I  Using localhost value of localhost
2018-12-27 08:38:04.762853 I  Start up testing connections. DB localhost, BE , attempt 0, status dbAwake
2018-12-27 08:38:05.782913 I  Start up testing connections. DB localhost, BE , attempt 1, status dbAwake
2018-12-27 08:38:05.796265 I  Loading en_us translation for module mythfrontend
2018-12-27 08:38:05.802821 I  Starting IO manager (write)
2018-12-27 08:38:05.802837 I  Starting process signal handler
2018-12-27 08:38:05.802830 I  Starting process manager
2018-12-27 08:38:05.802920 I  Starting IO manager (read)
2018-12-27 08:38:05.853934 I  ScreenSaverX11Private: DPMS is active.
2018-12-27 08:38:06.097917 N  Desktop video mode: 1920x1080 60.000 Hz
2018-12-27 08:38:06.296708 E  DB Error (StorageGroup::StorageGroup()):
Query was:

Driver error was [1/-1]:
Driver not loaded
Database error was:
Driver not loaded

2018-12-27 08:38:06.339573 I  LIRC: Successfully initialized '/dev/lircd' using '/home/mythtv/.mythtv/lircrc' config
2018-12-27 08:38:06.339623 I  No joystick configuration found, not enabling joystick control
2018-12-27 08:38:06.409932 E  CECAdapter: Failed to find any CEC devices.
2018-12-27 08:38:06.410016 I  CECAdapter: Closing down CEC.
2018-12-27 08:38:06.410042 I  UDPListener: Enabling
2018-12-27 08:38:06.410183 I  Binding to UDP 0.0.0.0:0
2018-12-27 08:38:06.410215 I  Binding to UDP [::]:0
2018-12-27 08:38:06.420934 I  Using Frameless Window
2018-12-27 08:38:06.420937 I  Using Full Screen Window
2018-12-27 08:38:06.466612 I  UI Screen Resolution: 1920 x 1080
2018-12-27 08:38:06.597920 W  OpenGL: Could not determine whether Sync to VBlank is enabled.
2018-12-27 08:38:06.612763 I  Trying the OpenGL 1.2 render
2018-12-27 08:38:06.612865 I  OpenGL painter using existing OpenGL context.
2018-12-27 08:38:06.619072 I  OpenGL1: Fragment program support available
2018-12-27 08:38:06.619108 I  OpenGL: OpenGL vendor  : Intel Open Source Technology Center
2018-12-27 08:38:06.619110 I  OpenGL: OpenGL renderer: Mesa DRI Intel(R) Haswell Desktop
2018-12-27 08:38:06.619112 I  OpenGL: OpenGL version : 3.0 Mesa 18.0.5
2018-12-27 08:38:06.619115 I  OpenGL: Max texture size: 16384 x 16384
2018-12-27 08:38:06.619117 I  OpenGL: Max texture units: 8
2018-12-27 08:38:06.619128 I  OpenGL: Direct rendering: Yes
2018-12-27 08:38:06.619132 I  OpenGL: Extensions Supported: 1a1f
2018-12-27 08:38:06.619133 I  OpenGL: PixelBufferObject support available
2018-12-27 08:38:06.619134 I  OpenGL: Initialised MythRenderOpenGL
2018-12-27 08:38:06.813395 N  Setting QT default locale to EN_US
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
2018-12-27 08:38:07.148518 I  MythUIWebBrowser: Loading css from - file:///home/mythtv/.mythtv/themes/blue-abstract-wide/htmls/mythbrowser.css
2018-12-27 08:38:07.149216 I  MythUIWebBrowser: enabling plugins
2018-12-27 08:38:07.218909 I  MythUIWebBrowser: Loading css from - file:///home/mythtv/.mythtv/themes/blue-abstract-wide/htmls/mythbrowser.css
2018-12-27 08:38:07.392208 I  MythUIWebBrowser: enabling plugins
2018-12-27 08:38:12.589552 I  Start up testing connections. DB localhost, BE , attempt 2, status dbAwake
2018-12-27 08:38:17.606149 I  Start up testing connections. DB localhost, BE , attempt 3, status dbAwake

User avatar
paulh
Developer
Posts: 390
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by paulh » Thu Dec 27, 2018 3:40 pm

Well at least that is one puzzle solved :)

Don't know why you are getting the 'Driver not loaded' errors that would appear to be key and could be pointing to a Qt installation problem.

Doesn't look like a permissions problem but wont do any harm to check the database is there and you can access it from the command line before digging any further.

Your log says it is 'Using configuration directory = /home/mythtv/.mythtv' so if you look at the the config.xml file there it will tell you the database host, name, user and password MythTV will use to access the database. So if you run this command substituting your host, db user, db name and password setting from config.xml you should be able to connect to the database.

Code: Select all

mysql -h192.168.1.32 -umythtv -p mythconverg

noyez
Newcomer
Posts: 5
Joined: Thu Dec 27, 2018 4:16 am
Italy

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by noyez » Thu Dec 27, 2018 5:15 pm

I can connect to the DB via command line as well as a toy QT program i wrote to exercise the QT Sql driver, see below.

Maybe my next step should be to compile mythtv from source? it appears as if that process is well documented.

Code: Select all

mythtv@myth ~ % mysql -h192.168.1.3 -umythtv -ppass mythconverg                                                                                                                               │··························································
Reading table information for completion of table and column names                                                                                                                                  │··························································
You can turn off this feature to get a quicker startup with -A                                                                                                                                      │··························································
                                                                                                                                                                                                    │··························································
Welcome to the MariaDB monitor.  Commands end with ; or \g.                                                                                                                                         │··························································
Your MariaDB connection id is 225                                                                                                                                                                   │··························································
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04                                                                                                                                       │··························································
                                                                                                                                                                                                    │··························································
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.                                                                                                                                │··························································
                                                                                                                                                                                                    │··························································
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.                                                                                                                      │··························································
                                                                                                                                                                                                    │··························································
MariaDB [mythconverg]>

My Qt main.cpp with a simple select statement to test the QT Sql driver:

Code: Select all

#include <QtCore>
#include <QtSql>
#include <QtDebug>

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("localhost");
    db.setDatabaseName("mythconverg");
    db.setUserName("mythtv");
    db.setPassword("pass");
    if(db.open())
    {
        qDebug() << "connected " << db.hostName();
        QSqlQuery query("SELECT username FROM users");
        while (query.next()) {
            QString username = query.value(0).toString();
            qDebug()<<"username: "<<username;
        }
    }
    else { qDebug() << "Connection FAILED."; }
    return 0;
}

User avatar
bill6502
Developer
Posts: 1180
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by bill6502 » Thu Dec 27, 2018 9:56 pm

Please run this: mythtv-setup.real --verbose database:debug,file:debug

When I do, the 1st query is this: SELECT data FROM settings WHERE value = 'freqtable' ...

and the storage group query happens 39 queries later. I'm guessing that it isn't a driver
error. It's also odd that the Query was: output is blank.

Get your profile name (hostname): curl --header Accept:application/JSON localhost:6544/Myth/GetHostName
It looks like 'localhost' is the answer, but verify.

Then, try this query from mysql: SELECT DISTINCT dirname FROM storagegroup WHERE groupname = 'Themes' AND hostname = 'hostNameFromAbove'
Last edited by bill6502 on Thu Dec 27, 2018 11:40 pm, edited 1 time in total.

noyez
Newcomer
Posts: 5
Joined: Thu Dec 27, 2018 4:16 am
Italy

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by noyez » Fri Dec 28, 2018 1:34 am

bill6502 wrote:
Thu Dec 27, 2018 9:56 pm
Please run this: mythtv-setup.real --verbose database:debug,file:debug
I snipped the output after the DB Connection error, however i can supply the whole log file if desired, just let me know.

Code: Select all

mythtv@myth ~ % DISPLAY=:0 mythtv-setup.real --verbose database:debug,file:debug

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-mythtv'
2018-12-27 20:16:00.549009 I  Setup Interrupt handler
2018-12-27 20:16:00.549023 I  Setup Terminated handler
2018-12-27 20:16:00.549026 I  Setup Segmentation fault handler
2018-12-27 20:16:00.549030 I  Setup Aborted handler
2018-12-27 20:16:00.549033 I  Setup Bus error handler
2018-12-27 20:16:00.549037 I  Setup Floating point exception handler
2018-12-27 20:16:00.549040 I  Setup Illegal instruction handler
2018-12-27 20:16:00.549044 I  Setup Real-time signal 0 handler
2018-12-27 20:16:00.549048 I  Setup Hangup handler
2018-12-27 20:16:00.549123 C  mythtv-setup version:  [v29.1] www.mythtv.org
2018-12-27 20:16:00.549128 C  Qt version: compile: 5.9.5, runtime: 5.9.5
2018-12-27 20:16:00.549130 N  Enabled verbose msgs:  general database file
2018-12-27 20:16:00.549138 N  Setting Log Level to LOG_INFO
2018-12-27 20:16:00.559493 I  Added logging to the console
2018-12-27 20:16:00.659970 D  New Logging Client: ID:  (#1)
2018-12-27 20:16:00.766192 N  Using runtime prefix = /usr
2018-12-27 20:16:00.766205 N  Using configuration directory = /home/mythtv/.mythtv
2018-12-27 20:16:00.766344 I  Assumed character encoding: en_US.UTF-8
2018-12-27 20:16:00.766936 E  (old)Settings::ReadSettings(settings.txt) - No such file settings.txt
2018-12-27 20:16:00.767143 I  Using localhost value of localhost
2018-12-27 20:16:00.767160 I  Clearing Settings Cache.
2018-12-27 20:16:00.767228 I  Start up testing connections. DB localhost, BE , attempt 0, status dbAwake
2018-12-27 20:16:01.768977 I  Start up testing connections. DB localhost, BE , attempt 1, status dbAwake
2018-12-27 20:16:01.769523 I  Loading en_us translation for module mythfrontend
2018-12-27 20:16:01.788659 I  Starting IO manager (read)
2018-12-27 20:16:01.788712 I  Starting process manager
2018-12-27 20:16:01.788739 I  Starting IO manager (write)
2018-12-27 20:16:01.788797 I  Starting process signal handler
2018-12-27 20:16:01.839767 I  ScreenSaverX11Private: DPMS is active.
2018-12-27 20:16:01.858842 N  Desktop video mode: 1920x1080 60.000 Hz
2018-12-27 20:16:02.042603 I  Database object created: DBManager0
2018-12-27 20:16:02.042623 I  New DB connection, total: 1
2018-12-27 20:16:02.042719 E  DB Error (StorageGroup::StorageGroup()):
Query was:

Driver error was [1/-1]:
Driver not loaded
Database error was:
Driver not loaded

2018-12-27 20:16:02.043544 E  (old)Settings::ReadSettings(settings.txt) - No such file settings.txt
When I do, the 1st query is this: SELECT data FROM settings WHERE value = 'freqtable' ...
Just in case you wanted to know the result of that query.

Code: Select all

MariaDB [mythconverg]> SELECT data FROM settings WHERE value = 'freqtable';
+----------+
| data     |
+----------+
| us-bcast |
+----------+
1 row in set (0.00 sec)
and the storage group query happens 39 queries later. I'm guessing that it isn't a driver
error. It's also odd that the Query was: output is blank.
Yup. I've been looking at this for a few days before posting. its got me baffled.
Get your profile name (hostname): curl --header Accept:application/JSON localhost:6544/Myth/GetHostName
It looks like 'localhost' is the answer, but verify.
This command doesn't connect. Does this require the backend running? the backend doesn't start since it can't connect to the DB either.
Then, try this query from mysql: SELECT DISTINCT dirname FROM storagegroup WHERE groupname = 'Themes' AND hostname = 'hostNameFromAbove'
Since i coudln't get the hostname from the above command, i just did a SELECT * FROM storagegroup and it looks like the hostname is myth not localhost

Code: Select all

MariaDB [mythconverg]> SELECT * FROM storagegroup;
+----+-------------+----------+----------------------------+
| id | groupname   | hostname | dirname                    |
+----+-------------+----------+----------------------------+
| 14 | Default     | myth     | /media/mythtv/recordings/  |
| 17 | Videos      | myth     | /media/mythtv/videos/      |
| 20 | Fanart      | myth     | /media/mythtv/fanart/      |
| 18 | Trailers    | myth     | /media/mythtv/trailers/    |
| 19 | Coverart    | myth     | /media/mythtv/coverart/    |
| 21 | Screenshots | myth     | /media/mythtv/screenshots/ |
| 22 | Banners     | myth     | /media/mythtv/banners/     |
| 16 | DB Backups  | myth     | /media/mythtv/db_backups/  |
| 15 | LiveTV      | myth     | /media/mythtv/livetv/      |
| 24 | Streaming   | myth     | /media/mythtv/streaming/   |
| 23 | Photographs | myth     | /media/mythtv/pictures/    |
+----+-------------+----------+----------------------------+
I did notice that the hostname myth is 127.0.1.1 in /etc/hosts, i tired editing the hosts file to have myth resolve to 127.0.0.1 and then to 192.168.1.3, which is its external IP, but i get the same result.

Perhaps this is a DB configuration problem? I recently went from mysql-5.7 to mariadb 10.1. i thought i had mythtv running fine for a period of time after that upgrade, but perhaps something went wrong w/ that upgrade. I thought that maybe the QT drive was incompatible with mariaDB, which is why i wrote that simple QT program, however that connected fine using the QT sql driver.

I've got the code downloaded and compiling right now. If you have any thoughts on where to explore first, let me know.

User avatar
bill6502
Developer
Posts: 1180
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by bill6502 » Fri Dec 28, 2018 1:59 am

Right, the mythbackend must be up for the curl above to work, sorry.

Note the log line: ... Using localhost value of localhost

That's the profile being used when mythAnything starts. When it's different from
the output of the hostname command, it means that you've chosen to put an
entry in config.xml's <LocalHostName>my-unique-identifier-goes-here</LocalHostName>
line. It can be just like the above, empty or even missing and then the hostname will
be used.

Try restoring the line and test again. You're using a profile that doesn't exist based on
your storage group query above. Thus it appears that you have no storage groups.

Why I don't get that query 1st is a mystery. Could be that you're on *buntu and I'm
building from source and on v30-Pre.

noyez
Newcomer
Posts: 5
Joined: Thu Dec 27, 2018 4:16 am
Italy

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by noyez » Sat Jan 12, 2019 6:34 pm

Solved it ... phew, that was a scary couple of weeks w/o MythtTV! Thanks to those that replied, it really motivated me to figure this out.

tl;dr:
It was not a mythTV problem, but a mariaDB reconfiguration, which is no surprise since everything was working until i upgraded the DB.

mariaDB was configured to listen to the external IP address of my mythtv-box, 192.168.1.3, and not on the loopback address, which i believe was the same for my mysql-server before upgrading to mariaDB. The result is that i could connect to the DB (via mysql client) when using the host of 192.168.1.3 AND localhost, but i could not connect using 127.0.0.1, nor 127.0.1.1. I configured mariaDB to listen on 0.0.0.0 (i.e. all interfaces), and everything was happy.

I have seen a few other posts about mariaDB allowing connections from “localhost” but not 127.0.0.1, i’m not familiar with mariaDB, so i’m not all that clear how these would be different, especially seeing the /etc/hosts file contains an alias for localhost as 127.0.0.1 and no other references to localhost.

Code: Select all

  127.0.0.1   localhost
so:

Code: Select all

mysql -h localhost -u root
should be the same as

Code: Select all

 mysql -h 127.0.0.1 -u root
, but that didn’t seem to be the case.

longer version:

After digging through the code and adding some debug statements around the DB connections, i focused on the following output form the log:

Code: Select all

I CoreContext mythcontext.cpp:852 (TestDBconnection) Start up testing connections. DB localhost, BE , attempt 5, status dbAwake
Note that there is no defined BackEnd (BE), its just a blank space, so i dug through the code to understand why BE was empty. the code is as follows (shortened):

form mythtv/libs/libmyth/mythcontext.cpp

Code: Select all

            LOG(VB_GENERAL, LOG_INFO,
                 QString("Start up testing connections. DB %1, BE %2, attempt %3, status %4")
                      .arg(host).arg(backendIP).arg(attempt).arg(guiStatuses[startupState]));
…

                masterserver = gCoreContext->GetSetting
                    ("MasterServerName");
                backendIP = gCoreContext->GetSettingOnHost
                    ("BackendServerAddr", masterserver);
masterserver and backendIP are getting set by getSetting and GetSettingOnHost. I did look throuhg the settings database and some ‘host’ values are ‘NULL’ so i assumed that if the ‘host’ value was ‘NULL’ that the localhost would be used, so i tried connected to the DB using ‘localhost’, then using ’127.0.0.1’, the latter didn’t work, so i reconfigured mariaDB as mentioned above, and it all seemed to work.

After figuring this out, i'm not really sure what i'd change so this doesn't happen to anyone else. its hard to protect against misconfigurations outside of mythtv. It is odd that mariaDB is treating "localhost" differently from "127.0.0.1", perhaps its a bug in mariaDB.

User avatar
bill6502
Developer
Posts: 1180
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Can't Connection to DB (mythtv not linking to libQt5Sql)

Post by bill6502 » Wed Jan 16, 2019 8:12 pm

Hi,

NULL hostnames in the DB are known to be Global, e.g. not specific to any host.

Hopefully, or for other readers of this thread, local changes to maria's settings go in:

Code: Select all

cat /etc/mysql/mariadb.conf.d/mythtv.cnf 
[mysqld]
bind-address=:: # or whatever your choice is
That way if a package manager releases a new configuration, it won't stomp on yours.
You can name the file anything you like as long as it ends with .cnf. Also, files there are
parsed in lexicographic order, so make your choice appear last. Some use zmythtv.cnf.

Post Reply