[mythtv-users] mythbackend "Lost connection to MySQL server during query" error?

Tom Dexter digitalaudiorock at gmail.com
Sun Jun 13 13:04:30 UTC 2021

I'm runing MythTV 29.1 under gentoo, with MariaDB 10.4. Yesterday
morning I had something happen that I've never had before. I noticed
that the system showed no upcoming recordings at all.

What I discovered in the mythbackend log was that, when the reschedule
was triggered by myhthfilldatabase at about 9 AM, the SQL queries all
failed to prepare. The first of those errors indicated a lost mysql

2021-06-12 09:07:28.346179 E [1492/1708] Scheduler mythdbcon.cpp:872
(prepare) - Error preparing query: DELETE recordmatch FROM
recordmatch, channel WHERE recordmatch.chanid = channel.chanid
2021-06-12 09:07:28.346221 E [1492/1708] Scheduler mythdbcon.cpp:874
(prepare) - Driver error was [2/2013]:
QMYSQL3: Unable to prepare statement
Database error was:
Lost connection to MySQL server during query

A simple restart of the mythbackend corrected everything.

On Thursday I'd run a pretty big update in gentoo, though I don't
think that's related, especially since everything had worked find
after that update. The update did include a minor update to
dev-db/mysql-connector-c, which I know is used by dev-qt/qtsql, but
again, I doubt that's related. Also note that there's no indication
that anything happened with mysql itself. It was running the whole
time without any errors etc.

I know that the mysql wait_timeout is 8 hours, and as it turns out,
the backend was in fact pretty idle for quite some time before that
failure. For example, the only notable activity in the log before that
failure was a reschedule 12 hours earlier.

Can a long idle period that exceeds the mysql wait_timeout cause that?
I'd think that if that were the case, I would have run into this
sometime in all the years of running MythTV.

Thanks in advance!

More information about the mythtv-users mailing list