[mythtv-users] mythtv cannot connect to database

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Jul 10 05:41:45 UTC 2020

On Thu, 9 Jul 2020 22:38:38 -0500, you wrote:

>On Thu, Jul 9, 2020 at 8:06 PM Stephen Worthington <stephen_agent at jsw.gen.nz>
>> On Thu, 9 Jul 2020 14:58:27 -0500, you wrote:
>> >On Thu, Jul 9, 2020 at 2:42 PM George Bingham <georgeb1962 at gmail.com>
>> wrote:
>> >
>> >> Hello all,
>> >>
>> >> I've had a functioning 31 fixes combo fe/be running for a few weeks.
>> >>
>> >> Today I got frontend 31 installed on a laptop and so I am trying to
>> enable
>> >> it to access the backend.
>> >>
>> >> To that end I know I have to set mysql to accept connections from the
>> >> network, but my attempts don't seem to be working.
>> >>
>> >> I have in /etc/mysql two "bind-address" lines, one in conf.d/mythtv.cnf,
>> >> and one in mysql.conf.d/mysqld.cnf. They are both set to the IP address
>> of
>> >> my mythtv backend machine (where the database is running too).
>> >>
>> >> When I start either mythtv-setup, I get the screen where it's not able
>> to
>> >> connect to the database.  Starting the backend similarly results in the
>> >> lines attempting to access the database repeatedly in the backend log
>> file.
>> >>
>> >> Similarly, cannot connect from the frontend machine either.
>> >>
>> >> I CAN connect from the laptop (remote frontend) via mysql directly
>> >> however, so I know the database is running and able to accept networked
>> >> connections. I just don't know what's going wrong with either the
>> backend
>> >> or the frontend not being able to connect.
>> >>
>> >> I am sure it's something simple, but currently at a loss!
>> >>
>> >> Help?
>> >>
>> >> Thanks,
>> >> -- George
>> >>
>> >
>> >Nevermind. Simply changing the "bind-address" to * instead of the IP
>> >address was the answer.
>> >
>> >Sorry to waste this valuable resource!
>> If you are using IPv6 on your network, you should use :: instead of *.
>> The reason that the backend was unhappy when you set a specific IP
>> address for the mysql bind-address was that you had not changed the IP
>> address the backend was connecting to so that it also used that
>> specific address.  So the backend was still trying to connect on
>> localhost ( and mysqld was not listening on localhost any
>> more.  Leaving the backend connecting on localhost to mysql is good -
>> it gets a much faster connection that way.  Only external connections
>> should be using the external IP address to talk to mysql.
>> When you have more than one bind-address line in your mysql config
>> files, it is best to comment out one of them (put a # character at the
>> start of the line).  There is a specific order that the config files
>> are read in, and only one of those bind-address settings will actually
>> be working, which will be the last one that gets read.
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://lists.mythtv.org/mailman/listinfo/mythtv-users
>> http://wiki.mythtv.org/Mailing_List_etiquette
>> MythTV Forums: https://forum.mythtv.org
>Hi Stephen,
>Thanks for the info!
>In mythtv-setup, I reset the IP Address to, so now the backend is
>connecting directly to the database?
>well, that works for the FE/BE, but not the remote frontend. How do you
>make the local frontend connect directly, while still using the network for
>remote connections?

In mythtv-setup go to:

1. General > Host Address Backend Setup

and set the "Listen on All IP Addresses" option.  Set the "Primary IP
address / DNS name" to the external IP address of the backend box.  If
you run a local DNS server on your network, you can use the DNS name
instead of the IP address.  This address is what mythfrontend fetches
from the database when it starts up.  So mythfrontend reads its local
config.xml and uses that to connect to the database, then fetches the
"Primary IP address / DNS name" value from that database and connects
to the backend on that address.  The "Primary IP address / DNS name"
is called BackendServerAddr in the settings table in the database.

If you want to have frontends on subnets other than the one the
backend is running on, then also set the "Allow Connections from all
Subnets" option.  What that means is if you have mythbackend on say (and that subnet is a /24 ie netmask, then
without the "all subnets" option, only devices on 192.168.1.x
addresses will be allowed to connect.  So if you have your kids
connecting from say 192.168.2.x where they have special access control
for their Internet connections, they will not be able to connect to
the backend.  I have the "all subnets" option set so that people who
are on my Guest subnet ( will be able to access
mythbackend on

Then on the backend PC, if you run mythfrontend there, in the
/host/<mythfrontend user>/.mythtv/config.xml file, change the <Host>
setting to localhost.  When mythfrontend is told to connect on
localhost, it does a special trick - it first checks to see if it can
make a direct connection using a Unix socket.  If that succeeds, it
will use that as it is the highest bandwidth connection it can get to
mysql and mythbackend.

More information about the mythtv-users mailing list