Mailing List Archive

mythtv cannot connect to database
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
Re: mythtv cannot connect to database [ In reply to ]
On Thu, Jul 9, 2020 at 2:42 PM George Bingham <georgeb1962@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!
Re: mythtv cannot connect to database [ In reply to ]
On Thu, 9 Jul 2020 14:58:27 -0500, you wrote:

>On Thu, Jul 9, 2020 at 2:42 PM George Bingham <georgeb1962@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 (127.0.0.1) 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@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythtv cannot connect to database [ In reply to ]
On Thu, Jul 9, 2020 at 8:06 PM Stephen Worthington <stephen_agent@jsw.gen.nz>
wrote:

> On Thu, 9 Jul 2020 14:58:27 -0500, you wrote:
>
> >On Thu, Jul 9, 2020 at 2:42 PM George Bingham <georgeb1962@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 (127.0.0.1) 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@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 127.0.0.1, 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?

Thanks,

George
Re: mythtv cannot connect to database [ In reply to ]
On 7/9/20 10:38 PM, George Bingham wrote:
> In mythtv-setup, I reset the IP Address to 127.0.0.1, so now the backend is
> connecting directly to the database?

No.

In mythtv-setup: General->Host Address Backend Setup->Primary IP Address/DNS Name
is typically set to the Private Network address of the backend. That way remote
frontends can connect to it. Setting it to the localhost prevents that.

Although usually the same address, the above isn't the address of the DB server. That's
what goes in config.xml. For a BE and combined FE/BE, the Host value in config.xml
should be localhost (unless the DB is served on another host.)

config.xml's Host value on a remote FE should be the hostname or IP of the host
with the DB.

Back in mythtv-setup, tale note of the "Listen on All IP Addresses" help text.
You want that checked.

--
Bill
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythtv cannot connect to database [ In reply to ]
> On 10 Jul 2020, at 11:38 am, George Bingham <georgeb1962@gmail.com> wrote:
>
>
> In mythtv-setup, I reset the IP Address to 127.0.0.1, 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?

George it is simple, but oh so intricate

The be must be setup to use the ip, not 127.0.0.1. 127 is localhost and wont work on remote frontends
The fe may use 127 or ip. It is local
The remote fe must use the be:ip

Next you must setup the grants in mysql. Ubuntu will accept % as localhost. Suse will not.

On suse I grant mythtv-stuff to localhost and to %

bottom. line is mysql -umythtv -pmythtv mythconverg must work locally on fe/be machine
and
mysql -umythtv -pmythtv -h be.machine mythconverg must work on the remote laptop

ubuntu uses a silly pasword.
My wildcard id 192.168.5.%
My wife wont hack mythtv, so sensible passwds suit me

The src code has a mc.sql for setup of the DB. You may need to find it.
That is it!
James
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythtv cannot connect to database [ In reply to ]
On Thu, 9 Jul 2020 22:38:38 -0500, you wrote:

>On Thu, Jul 9, 2020 at 8:06 PM Stephen Worthington <stephen_agent@jsw.gen.nz>
>wrote:
>
>> On Thu, 9 Jul 2020 14:58:27 -0500, you wrote:
>>
>> >On Thu, Jul 9, 2020 at 2:42 PM George Bingham <georgeb1962@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 (127.0.0.1) 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@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 127.0.0.1, 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?
>
>Thanks,
>
>George

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
192.168.1.21 (and that subnet is a /24 ie netmask 255.255.255.0), 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 (10.0.1.0/24) will be able to access
mythbackend on 10.0.2.4.

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.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: mythtv cannot connect to database [ In reply to ]
On Fri, Jul 10, 2020 at 12:43 AM Stephen Worthington <
stephen_agent@jsw.gen.nz> wrote:

> On Thu, 9 Jul 2020 22:38:38 -0500, you wrote:
>
> >On Thu, Jul 9, 2020 at 8:06 PM Stephen Worthington <
> stephen_agent@jsw.gen.nz>
> >wrote:
> >
> >> On Thu, 9 Jul 2020 14:58:27 -0500, you wrote:
> >>
> >> >On Thu, Jul 9, 2020 at 2:42 PM George Bingham <georgeb1962@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 (127.0.0.1) 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@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 127.0.0.1, 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?
> >
> >Thanks,
> >
> >George
>
> 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
> 192.168.1.21 (and that subnet is a /24 ie netmask 255.255.255.0), 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 (10.0.1.0/24) will be able to access
> mythbackend on 10.0.2.4.
>
> 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.
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org



Excellent information, thanks everyone. I know that this is the most basic
info that everyone that has a remote front-end encounters. And I have
encountered it in the past as well. I'd had a myth setup that ran for
several years until my server crapped out. I was broke at the time, and
mostly still am so it took me a while to replace it, but got lucky and
found a decent desktop that's got an i7, 8Gig ram, fairly low-end graphics
card but definitely adequate to the task of rendering mythtv - ~$200. Just
popped my hauppauge 2255 card in and got it up and running quickly with the
latest xubuntu and myth.

It took me a while to realize that my laptop could run the latest v31 on my
old 18.04 system, so finally got that going but was quickly stymied by my
attempts to connect. Thanks for clearing that up, it had been about 8 years
ago that I'd figured out how to connect remotely.

Anyway, love having it all working again and VERY HAPPY that you all are
out there to help!

George