[mythtv-users] BE3 - Issues with installation and database

Stephen Worthington stephen_agent at jsw.gen.nz
Wed May 22 05:55:39 UTC 2019


On Tue, 21 May 2019 19:49:54 -0500, you wrote:

>
>
>Hi Stephan!
>
>
>MariaDB [(none)]> show grants;
>
>The [(none)] above is because you haven't selected a database on the 
>command line. Not a problem.
>Yes, you need to select a database for a database name to show up in
>the prompt as the current database. To do that, you can add the
>database name at the end of the "mysql" command:
>
>mysql mythconverg
>
>or use the -D option:
>
>mysql -D mythconverg
>
>Or at the MariaDB prompt, do this:
>
>use mythconverg;
>
>
>    barry at Backend-3:~$ mysql mythconverg
>
>    ERROR 1698 (28000): Access denied for user 'barry'@'localhost'

You might like to add a GRANT for user 'barry' also, as that means you
can use the "mysql" command without sudo from your normal login
(except for doing GRANT commands or adding users):

sudo mysql
GRANT ALL ON mythconverg.* TO barry@'localhost' IDENTIFIED BY
"<password>";
FLUSH PRIVILEGES;
quit

Replace <password> with the password you use to login as 'barry'. Then
test it with:

mysql mythconverg
select * from settings where value like '%serverip%';
quit

This is what I get:

MariaDB [mythconverg]> select * from settings where value like
'%serverip%';
+------------------+----------+----------+
| value            | data     | hostname |
+------------------+----------+----------+
| MasterServerIP   | 10.0.2.4 | NULL     |
| BackendServerIP  | 10.0.2.4 | mypvr    |
| BackendServerIP6 | ::1      | mypvr    |
+------------------+----------+----------+
3 rows in set (0.00 sec)

If you have user 'barry' on all your PCs with the same password, then
you could change the GRANT line to:

GRANT ALL ON mythconverg.* TO barry@'%' IDENTIFIED BY "<password>";

which would allow you to login as user 'barry' from anywhere using
that same password.


>    barry at Backend-3:~$ sudo mysql
>
>    [sudo] password for barry:
>
>    Welcome to the MariaDB monitor. Commands end with ; or \g.
>
>    Your MariaDB connection id is 116
>
>    Server version: 10.1.38-MariaDB-0ubuntu0.18.04.2 Ubuntu 18.04
>
>
>    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
>
>
>    Type 'help;' or '\h' for help. Type '\c' to clear the current input
>    statement.
>
>
>    MariaDB [(none)]> mysql mythconverg
>
>    -> use mythconverg;
>
>    ERROR 1064 (42000): You have an error in your SQL syntax; check the
>    manual that corresponds to your MariaDB server version for the right
>    syntax to use near 'mysql mythconverg
>
>    use mythconverg' at line 1
>
>    MariaDB [(none)]>
>
>        Looks like something didn’t ‘click’ as got the [(none)] but
>        apparently good something happened as seen in the next step.

Just a little confusion, nothing wrong.  You sent the Bash command
"mysql mythconverg" to the "mysql" prompt, not a Bash prompt.  You
should be able to use "mysql mythconverg" now to work on the
mythconverg database, rather than having to use "sudo mysql
mythconverg".  You should only need to use "sudo mysql" now for GRANT
commands and anything do to with managing users.  Commands for use of
the mythconverg database can now be done with a normal login, rather
than needing root.

>But before the mythconverg database existed, those commands would not 
>work, so I did not put selecting a database into the commands I gave you.
>		Makes sense.
>So, from what I can see in the pastebin log, the mythconverg database 
>should have been created and populated. To check that, you can try these 
>commands:
>
>sudo mysql
>show databases;
>use mythconverg;
>show tables;
>quit
>
>    barry at Backend-3:~$ mysql mythconverg
>
>    ERROR 1698 (28000): Access denied for user 'barry'@'localhost'
>
>    barry at Backend-3:~$ sudo mysql
>
>    [sudo] password for barry:
>
>    Welcome to the MariaDB monitor. Commands end with ; or \g.
>
>    Your MariaDB connection id is 116
>
>    Server version: 10.1.38-MariaDB-0ubuntu0.18.04.2 Ubuntu 18.04
>
>
>    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
>
>
>    Type 'help;' or '\h' for help. Type '\c' to clear the current input
>    statement.
>
>
>    MariaDB [(none)]> mysql mythconverg
>
>    -> use mythconverg;
>
>    ERROR 1064 (42000): You have an error in your SQL syntax; check the
>    manual that corresponds to your MariaDB server version for the right
>    syntax to use near 'mysql mythconverg
>
>    use mythconverg' at line 1
>
>    MariaDB [(none)]>
>
>    MariaDB [(none)]>
>
>    MariaDB [(none)]>
>
>    MariaDB [(none)]>
>
>    MariaDB [(none)]> show databases;
>
>    +--------------------+
>
>    | Database |
>
>    +--------------------+
>
>    | information_schema |
>
>    | mysql |
>
>    | mythconverg |
>
>    | performance_schema |
>
>    +--------------------+
>
>    4 rows in set (0.01 sec)
>
>
>    MariaDB [(none)]>
>
>    MariaDB [(none)]>
>
>    MariaDB [(none)]> use mythconverg;
>
>    Reading table information for completion of table and column names
>
>    You can turn off this feature to get a quicker startup with -A
>
>
>    Database changed
>
>    MariaDB [mythconverg]> show tables;
>
>    +---------------------------+
>
>    | Tables_in_mythconverg |
>
>    +---------------------------+
>
>    | capturecard |
>
>    | cardinput |
>
>    | channel |
>
>    | channelgroup |
>
>    | channelgroupnames |
>
>    | channelscan |
>
>    | channelscan_channel |
>
>    | channelscan_dtv_multiplex |
>
>    | codecparams |
>
>    | credits |
>
>    | customexample |
>
>    | diseqc_config |
>
>    | diseqc_tree |
>
>    | displayprofilegroups |
>
>    | displayprofiles |
>
>    | dtv_multiplex |
>
>    | dtv_privatetypes |
>
>    | dvdbookmark |
>
>    | dvdinput |
>
>    | dvdtranscode |
>
>    | eit_cache |
>
>    | filemarkup |
>
>    | housekeeping |
>
>    | inputgroup |
>
>    | internetcontent |
>
>    | internetcontentarticles |
>
>    | inuseprograms |
>
>    | iptv_channel |
>
>    | jobqueue |
>
>    | jumppoints |
>
>    | keybindings |
>
>    | keyword |
>
>    | livestream |
>
>    | logging |
>
>    | mythlog |
>
>    | oldfind |
>
>    | oldprogram |
>
>    | oldrecorded |
>
>    | people |
>
>    | pidcache |
>
>    | playgroup |
>
>    | powerpriority |
>
>    | profilegroups |
>
>    | program |
>
>    | programgenres |
>
>    | programrating |
>
>    | recgrouppassword |
>
>    | record |
>
>    | recorded |
>
>    | recordedartwork |
>
>    | recordedcredits |
>
>    | recordedfile |
>
>    | recordedmarkup |
>
>    | recordedprogram |
>
>    | recordedrating |
>
>    | recordedseek |
>
>    | recordfilter |
>
>    | recordingprofiles |
>
>    | recordmatch |
>
>    | scannerfile |
>
>    | scannerpath |
>
>    | settings |
>
>    | storagegroup |
>
>    | tvchain |
>
>    | tvosdmenu |
>
>    | upnpmedia |
>
>    | videocast |
>
>    | videocategory |
>
>    | videocollection |
>
>    | videocountry |
>
>    | videogenre |
>
>    | videometadata |
>
>    | videometadatacast |
>
>    | videometadatacountry |
>
>    | videometadatagenre |
>
>    | videopart |
>
>    | videopathinfo |
>
>    | videosource |
>
>    | videotypes |
>
>    +---------------------------+
>
>    79 rows in set (0.00 sec)
>
>
>    MariaDB [mythconverg]> quit
>
>    Bye

That all looks good - you have what looks like a normal set of
database tables for mythbackend, but do not yet have the additional
ones that mythfrontend will create when you next run it.

>This command will check that you can access the mythconverg database as 
>user "mythtv" from your PC's external IP address:
>
>mysql -h 192.168.0.3 -u mythtv -p mythconverg
>
>    barry at Backend-3:~$ mysql -h 192.168.0.3 -u mythtv -p mythconverg
>
>    Enter password: <entered mythtv’s: Z***S>
>
>    ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.3'
>    (101 "Network is unreachable")
>
>    barry at Backend-3:~$
>
>
>
>    May need to plug in the Ethernet cable to test. Right now I'm
>    uncomfortable doing so because of what happened to BE1. Will unplug
>    BE'2 tomorrow morning - currently being used to watch TV.
>
>
>    Looks like we're getting close!!

That error "Network is unreachable" says that the Ethernet cable is
out or for some other reason the 192.168.0.3 address has not been
assigned to the Ethernet port.  The actual meaning of that message is
that the "mysql" program sent a packet to open a connection to
192.168.0.3, and when that packet was matched against the routing
table in the PC's network stack, there was no place in that table that
matched, so the network stack was unable to send the packet directly
to 192.168.0.3 and it was also unable to send it to any router to get
it sent to 192.168.0.3.  So the packet was dropped and that error was
returned to the mysql program in an ICMP packet with the ICMP type
code set to "Network unreachable".

Check the output of this command:

ifconfig

and see if your Ethernet port is there and has the correct 192.168.0.3
address.  If the Ethernet port does not even show up in the listing
(which I think will be the case), try

ifconfig -a

which will list all ports, not just the ones that are current in "up"
state.

My guess is that since the Ethernet cable is still disconnected and
that port gets its IP address by DHCP from your router, it currently
has no IP address assigned.  If you had set it up with a static IP
address, I believe the command would have worked, even without the
Ethernet cable being plugged in.  This is going to be a problem for
further work on this setup as you will be needing to set mythbackend
to connect on the external IP address of the PC, rather than
localhost.  As soon as you do that, mythbackend will start up too
soon, before that IP address is available on the Ethernet port.  So it
will not work after boot, but will if you restart it after the network
is up:

sudo restart mythtv-backend

Since you want mythbackend and the mythconverg database accessible
from outside the PC, you do not want that IP address to ever change,
so having it assigned by DHCP is not really helpful - it probably
should be changed to a static IP assignment.  That would then allow
you to test things locally without having the Ethernet cable plugged
in.  You can set the IP address as a static one from Network Manager -
there should be an icon to access the Network Manager from the right
hand side of the icon bar at the top of the screen, depending on how
you have the PC set up.  I would need to know more about what sort of
setup you have on the PC to give specific instructions.

But even with a static IP address, you will still need to add a
systemd override file to get mythbackend to only start once the
network is actually available.  That is something to do later, as the
override file will make mythbackend not start until a long timeout (eg
60 seconds) when the network is not available, which is very annoying
when you are trying to test with the Ethernet cable out.


More information about the mythtv-users mailing list