[mythtv-users] UPDATED: Bash/MySQL script for copying and/or deleting mythfrontend profiles

Jeffrey J. Kosowsky mythtv at kosowsky.org
Wed Jan 13 02:06:00 UTC 2010


Matt Beadon wrote at about 13:14:02 -0800 on Tuesday, January 12, 2010:
 > >
 > > BTW it works like a charm and now I can see my myth recordings on my
 > > XP laptop -- woohooo....
 > >
 > > Here is an updated version of the code with some minor usability
 > > enhancements:
 > >
 > 
 > Great timing (for me)!  I just got my new laptop running last night and
 > fired up myth FE only to realize that I'd have to spend ages getting the
 > settings cloned from my existing FE before I'd be happy using it. :(  Then I
 > found this thread, thanks!  Haven't run it yet but I will when I get home.
 > 
 > I'm interested in the delete hostname function since I happen to have a few
 > leftover invalid entries in my DB from changing my hostname without doing it
 > the "mythtv way".
 > 
 > I'm not very familiar with mysql but I'd like to make the following
 > suggestions that I think would go really nicely with the current functions:
 > 1) list all hostnames that have some configuration info in the DB.  This
 > will let people like me clean up after their mistakes more easily using your
 > delete hostname command.  :)
 > 2) grant privileges to user at hostname (or user@"192.168.1.%" or some other
 > wildcard for home networks) to allow the new FE to connect to the DB since
 > by default only mythtv at localhost is allowed.  The syntax for this is shown
 > on this wiki http://www.mythtv.org/wiki/MythFrontend
 > 3) similar to delete hostname: revoke privileges to users/hostnames that
 > were added by mistake.  After way too long online I cobbled together the
 > following commands for example:
 > use mysql;
 > select HOST, User from user;  [to show my mistakes like adding
 > username=oops]
 > show grants for oops@"localhost";  [check that the user doesn't have access
 > to mysql for some app other than mythtv]
 > delete from user where host = "localhost" and user = "oops";  [clean up
 > entries]
 > 
 > Hmm #3 seems to involve more human interaction and double checking than I'd
 > really suggest for a script... perhaps that one's a bad idea?  At least now
 > I'll have those commands saved in this thread.
 > 
 > I still think that #1 would be great and perhaps #2 could be added as a
 > function within the copy hostname?  That way the new hostname is completely
 > ready to go after the copy.
 > 

First of all, I have had to learn on the fly how to do #2-3 to get my
setup working. However, I think that #2-3 are not really appropriate
for this script for 3 reasons:
1. This script acts on the 'mytchonverg' database (or optionally
   whatever you name it) while adding/deleting users and
   granting/revoking privileges act on the 'mysql' database
2. To use this script you only need the password (i.e. privileges) to
   modify 'mythconverg' while to add/delete users and privileges you
   need root privileges -- so it really belongs in another script
3. Changing users and privileges are simple one line mysql commands
   that are unlikely to cause damage. Plus there are mysql GUI's that
   make this even easier. On the other hand, the purpose of this
   script was to automate changes that would be difficult and
   error-prone to do manually.

I like the idea of your #1 and will see about adding it...


More information about the mythtv-users mailing list