[Solved] mythtv cannot connect to database

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

Moderator: Forum Moderators

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

[Solved] mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 4:36 pm

Hello,

I have been using MythTV for years on this machine. Now, after an upgrade to Debian Buster (with MythTV 30 from deb-multimedia) something broke and I can't figure out what it is.

The backend does not connect to the database. With mysql or mysqlshow I can connect to the DB using the same username and password as in /etc/mythtv/config.xml and ~/.mythtv/config.xml

Code: Select all

2019-07-08 15:57:39.179336 I  Start up testing connections. DB localhost, BE , attempt 10, status dbAwake, Delay: 2000
2019-07-08 15:57:44.185442 I  Start up failure. host localhost, status dbAwakeFail

Cannot login to database
So I tried the frontend from the console and it throws an error:

Code: Select all

E  DB Error (StorageGroup::StorageGroup()):
Query was:

Driver error was [1/]:
Driver not loaded
I figured it might have something to do with the Qt mysql drivers, and I have two versions of libqsqlmysql
in
/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/
/usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/

But it should automatically pick the Qt5 one, right?
What can I do to better pinpoint the problem?
Last edited by samweis on Tue Jul 09, 2019 3:53 pm, edited 1 time in total.

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

Re: mythtv cannot connect to database

Post by bill6502 » Mon Jul 08, 2019 5:06 pm

Hi,

1st step: https://www.mythtv.org/wiki/Config.xml#Troubleshooting note the Using configuration directory
part, it isn't in the log snippets above.

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

Re: mythtv cannot connect to database

Post by bill6502 » Mon Jul 08, 2019 5:09 pm

To answer your question, see the line in the log similar to this: ... Qt version: compile: 5.5.1, runtime: 5.5.1

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

Re: mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 6:41 pm

Thanks for the quick response!
This is what I have:

Code: Select all

Using configuration directory = /home/user/.mythtv
That's correct, and this also looks reasonable to me:

Code: Select all

C  mythfrontend version: fixes/30 [v30.0-4fd4d574c6d] www.mythtvorg
C  Qt version: compile: 5.11.3, runtime: 5.11.3
Sorry, I can't post the full log or a pastebin link because
"You can’t post image, email or url links."

User avatar
Steve Goodey
Moderator
Posts: 83
Joined: Fri Feb 07, 2014 6:30 pm
Location: Colchester, England
Great Britain

Re: mythtv cannot connect to database

Post by Steve Goodey » Mon Jul 08, 2019 6:53 pm

You can try inserting spaces into the url to allow you to post them until you get enough permission to post urls.

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

Re: mythtv cannot connect to database

Post by bill6502 » Mon Jul 08, 2019 7:04 pm

Initially, you mentioned checking /etc/mythtv/config.xml and ~/.mythtv/config.xml, but the
above says /home/user/.mythtv. I'd check that too. Typically, if /etc/mythtv/config.xml is
used, then the entries in /home/*/.mythtv are links to it, and they're known to get broken.

If that doesn't help (or if user meant $USER) then maybe you started the backend as yourself,
as opposed to user mythtv. If using something else, like systemd or the old upstart, then be sure
that the User= or --user= line is what you'd expect. And that's usually user mythtv. $MYTHCONFDIR
may be in play too.

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

Re: mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 7:10 pm

Good idea.
But meanwhile the forum system added me to the list of chosen ones. ;)

So here is the output of mythtv-frontend:
http://pasted.co/1491dbb1

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

Re: mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 7:27 pm

mythbackend is run with command line
/usr/bin/mythbackend --daemon --pidfile /var/run/mythtv/mythbackend.pid
and user mythtv via /etc/init.d/mythtv-backend and systemd.

I did not want to mess with the /etc/init.d/mythtv-backend, instead I started mythtv-frontend as user. It should at least connect to the DB, shouldn't it?
This is why you see references to /home/user... in the log.
/etc/mythtv/config.xml and /home/user/.mythtv/config.xml are identical, and this is the only user (besides mythtv) accessing mythtv on this box.

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

Re: mythtv cannot connect to database

Post by bill6502 » Mon Jul 08, 2019 8:17 pm

You're right, it should try. Does the package appear to be loaded:

Code: Select all

$ dpkg --list --no-pager libqt5sql5-mysql
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version              Architecture Description
+++-======================-====================-============-=================================
ii  libqt5sql5-mysql:amd64 5.12.2+dfsg-4ubuntu1 amd64        Qt 5 MySQL database driver

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

Re: mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 8:24 pm

Yes.

Code: Select all

~# LANG=C dpkg --list --no-pager libqt5sql5-mysql
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version        Architecture Description
+++-======================-==============-============-=================================
ii  libqt5sql5-mysql:amd64 5.11.3+dfsg1-1 amd64        Qt 5 MySQL database driver

busbee
Junior
Posts: 31
Joined: Sun Oct 14, 2018 12:07 pm
United States of America

Re: mythtv cannot connect to database

Post by busbee » Mon Jul 08, 2019 8:38 pm

Just to be absolutely clear:
does (also)
/etc/mythtv/config.xml = /home/mythtv/.mythtv/config.xml?

I think you left that one out.

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

Re: mythtv cannot connect to database

Post by bill6502 » Mon Jul 08, 2019 8:56 pm

Maybe see what's in the cache or see if they exist:

Code: Select all

$ ldconfig --print-cache | grep --color=none libQt5Sql
	libQt5Sql.so.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5
	libQt5Sql.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQt5Sql.so

$ ls -l /usr/lib/x86_64-linux-gnu/libQt5Sql*
lrwxrwxrwx 1 root root     19 Apr 11 08:29 /usr/lib/x86_64-linux-gnu/libQt5Sql.so -> libQt5Sql.so.5.12.2
lrwxrwxrwx 1 root root     19 Apr 11 08:29 /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 -> libQt5Sql.so.5.12.2
lrwxrwxrwx 1 root root     19 Apr 11 08:29 /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5.12 -> libQt5Sql.so.5.12.2
-rw-r--r-- 1 root root 302520 Apr 11 08:29 /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5.12.2

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

Re: mythtv cannot connect to database

Post by bill6502 » Mon Jul 08, 2019 9:06 pm

And then there was this, knew I'd been here before, same symptom, not a MythTV or driver issue:
viewtopic.php?f=36&t=2957&p=14245&hilit ... Sql#p14334

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

Re: mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 9:12 pm

User 'mythtv' does not have a home directory in /home on this system. Never had one. This is a standard installation with packages from deb-multimedia. The home directory of mythtv is /var/lib/mythtv and /var/lib/mythtv/.mythtv/config.xml is a symlink to /etc/mythtv/config.xml.

When I deliberately enter a wrong password into ~/.mythtv/config.xml, I get

Code: Select all

[Warning] Access denied for user 'mythtv'@'localhost' (using password: YES)
in /var/log/mysql/error.log when I start myth-frontend.
With the correct password this does not happen. Nothing gets logged in the mysql log - myth-frontend just does not connect.

BTW: I just removed libqsqlmysql.so and tried myth-frontend again.
It complains with "C FATAL: Unable to load the QT mysql driver, is it installed?" and quits.
If the driver is there, it fails at the same step but with "E DB Error (StorageGroup::StorageGroup()): ..."

Broken version of the library? Or one not compatible with this version of mariadb (10.3.15)?

samweis
Newcomer
Posts: 8
Joined: Mon Jul 08, 2019 3:50 pm
Germany

Re: mythtv cannot connect to database

Post by samweis » Mon Jul 08, 2019 9:37 pm

And then there was this, knew I'd been here before, same symptom,
Oh wait - that's a nasty one...

Mariadb treats 'localhost' differently from 127.0.0.1?
Thanks!
I'll try that tomorrow (right now I have a manual recording running and I am afraid that mythtv-backend will interfere if I succeed in starting it.)

Post Reply