[mythtv-users] Mythfrontend on Android-database access

Donald Brett dlbrett108 at yahoo.com
Mon May 16 14:41:38 UTC 2022


On 5/16/2022 5:28 AM, Stephen Worthington wrote:
> On Mon, 16 May 2022 09:53:27 +0100, you wrote:
>
>> On 16/05/2022 03:14, Stephen Worthington wrote:
>>> On Sun, 15 May 2022 13:11:27 -0500, you wrote:
>>>
>>>> By the way, a couple more data points; the mysql root user does not have
>>>> a password.  Also, the mythfrontend password is still mythtv, not the
>>>> generated one (y2i1MpJ8).  When migrating the old database to the new
>>>> machine, it seems to use the stock 'mythtv' password, so I left it as-is
>>>> (changed config.xml password).  Any other suggestions?
>>>>
>>>> Don
>>> There is a big difference between
>>>
>>> sudo mysql
>>>
>>> and
>>>
>>> mysql -u root -p
>>>
>>> When mysql is run from root with no password, it has full permissions
>>> for everything possible.  When it is run as user root with "-u root",
>>> it only has permissions a specified in the grants for user "root".
>>>
>>> When you migrate a database (or restore an old one), only the
>>> mythconverg database tables are migrated or restored by
>>> mythconverg_restore.pl.  Users and their grants are stored in the
>>> "mysql" database tables, and are not touched, so you have to manually
>>> set them up again.  They must match what you have in your config.xml
>>> files in /etc/mythtv, /home/mythtv/.mythtv and /home/<frontend
>>> user>/.mythtv.  When I move a database, I normally copy the old
>>> config.xml files and re-create the old users and grants, but you can
>>> choose to use the new config.xml settings too.  But you still need to
>>> create the users and grants.
>>>
>> Can I ask why the old users and grants are not migrated along with the database? After all, these
>> are essential metadata and having to (research and) re-input those commands introduces possibilities
>> for mistakes and errors.
> My guess would be that it is way too difficult.  Access to the users
> and grants requires MySQL/MariaDB permissions on the "mysql" database.
> The mythconverg_backup.pl program would need to be run as root to do
> that, or as a MySQL/MariaDB user with the special permissions
> required.  And then which users need to be backed up and restored?
> There would need to be options to allow the usernames to be specified
> as there is no automated way of finding all the config.xml files you
> are using and getting the usernames from them.  They can be on
> different PCs and devices.  And the "create user" and "grant" commands
> have been changing, so support would be needed for different versions
> of MySQL and MariaDB doing things differently.  And in any case, there
> is no way to extract the passwords from MySQL/MariaDB - the design of
> the way they work explicitly prevents that.  So the passwords would
> also need to be found in the config.xml files.
>
> The names of the backup and restore programs (mythconverg_backup.pl
> and mythconverg_restore.pl) also strongly suggest that they are only
> going to work on the mythconverg database, not on data stored anywhere
> else.
> _______________________________________________
> 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

Hmm, I don't recall creating users or grants, so assumed it was done for 
me on another step of the install.  I used this to load the previous 
database:

sudo /usr/share/mythtv/mythconverg_restore.pl --drop_database 
--create_database --filename 
/home/mythtv/db_backups/mythconverg-1350-20220501093643.sql.gz

Then adjusted config.xml to use the default password.

Anyway, I found a workaround for the mysql "identified by" issue here:

https://stackoverflow.com/questions/5555328/error-1396-hy000-operation-create-user-failed-for-jacklocalhost

And tried:

mysql> drop user mythtv@'%';
mysql> flush privileges;
mysql> create user mythtv@'%' identified by 'mythtv';
mysql> flush privileges;
mysql> show grants for mythtv;

+------------------------------------+
| Grants for mythtv@%                |
+------------------------------------+
| GRANT USAGE ON *.* TO `mythtv`@`%` |
+------------------------------------+
1 row in set (0.00 sec)

mysql> grant all privileges on mythconverg.* to 'mythtv'@'%';
mysql> show grants for mythtv;

+---------------------------------------------------------+
| Grants for mythtv@%                                     |
+---------------------------------------------------------+
| GRANT USAGE ON *.* TO `mythtv`@`%`                      |
| GRANT ALL PRIVILEGES ON `mythconverg`.* TO `mythtv`@`%` |
+---------------------------------------------------------+
2 rows in set (0.01 sec)

The local fe/be still works and now the ubuntu 18.04 box (johnny) has 
access.  But the ONN still has the same problem.  By the way, I turned 
off the V-32 backend and turned on the ubuntu 18.04 backend (on 
johnny).  ONN found it and asked to update the database, so I assume it 
was able to connect the it's mysql server.  I'll  check for differences 
between them.

Don


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the mythtv-users mailing list