Page 1 of 1

Strange database connection problem

Posted: Tue Jan 10, 2017 9:47 pm
by Eddles
Hi all, I used to use MythTV a long time ago, and am now getting back into it again. This time, I'm trying to set up a standard PC only for the backend and a Raspberry Pi to run the frontend. "mythtv" is the name of the backend bound to the IP address 192.168.1.9 running Debian Jessie, "raspberrypi" is the name of the frontend running raspbian and "voyager" is the name of my main computer not involved with mythtv. Both frontend & backend are using precompiled 0.28 binaries downloaded from the official repositories.

I've set up MythTV on "mythtv", and it seems to be working fine:

Code: Select all

voyager:~ kit$ ssh mythtv@192.168.1.9
mythtv@192.168.1.9's password: 
<snip>
Last login: Tue Jan 10 20:46:22 2017 from raspberrypi
$ ps aux | grep mythbackend
mythtv    2543  0.0  2.8 3912940 58688 ?       Ssl  21:11   0:00 /usr/bin/mythbackend --quiet --syslog local7
mythtv    2583  0.0  0.0   8172  1560 pts/2    S+   21:11   0:00 less mythbackend.log
mythtv    2661  0.0  0.1  12728  2244 pts/1    S+   21:20   0:00 grep mythbackend
$ 
Running mythfrontend shows the standard setup wizard and I enter the database address which is 192.168.1.9 as shown in the picture below:
database.jpg
database.jpg (134.27 KiB) Viewed 856 times
This is confirmed in the config.xml file on the frontend:

Code: Select all

  <Database>
    <PingHost>0</PingHost>
    <Host>192.168.1.9</Host>
    <UserName>mythtv</UserName>
    <Password>mythtv</Password>
    <DatabaseName>mythconverg</DatabaseName>
    <Port>3306</Port>
  </Database>
Connecting to the mysql server works fine:

Code: Select all

pi@raspberrypi:~ $ mysql -u mythtv -pmythtv -h 192.168.1.9 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 MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 216
Server version: 5.5.53-0+deb8u1 (Debian)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW TABLES;
+--------------------------------+
| Tables_in_mythconverg          |
+--------------------------------+
| archiveitems                   |
| bdbookmark                     |
| capturecard                    |
| cardinput                      |
| channel                        |
<snip>
But when I try to run mythfrontend, it tries to connect to the backend on localhost for some reason, which obviously fails:

Code: Select all

2017-01-10 21:27:53.878835 I  MythCoreContext::ConnectCommandSocket(): Connecting to backend server: 127.0.0.1:6543 (try 1 of 1)
2017-01-10 21:27:53.880004 E  MythSocket(6ac0d140:-1): Failed to connect to (127.0.0.1:6543) Connection refused
2017-01-10 21:27:53.880248 E  Connection to master server timed out.
                        Either the server is down or the master server settings
                        in mythtv-settings does not contain the proper IP address
I don't understand why the frontend is trying to connect to 127.0.0.1 and not 192.168.1.9 where the backend is located? I've double checked mythtv-setup on the backend and it shows "192.168.1.9" on both fields in the first screen.

Some help would be greatly appreciated!
With kind regards - Eddles

Re: Strange database connection problem

Posted: Wed Jan 11, 2017 12:26 am
by dizygotheca
Is your ping failing ?
viewtopic.php?f=36&t=1791&p=8739

Re: Strange database connection problem

Posted: Wed Jan 11, 2017 5:28 pm
by PhilB
There are a number of copies of config.xml.
Frontend uses ~/.mythtv/config.xml (ie under your normal login directory).
Backend uses /home/mythtv/.mythtv/config.xml
Also /etc/mythtv/config.xml which is linked to by the other two entries in some systems.

This is confusing but has flexibility for more complex situations.
Are you looking at ~/.mythtv/config.xml ?

Phil