[mythtv-users] Copy frontend settings to new frontend keeping both
R. G. Newbury
newbury at mandamus.org
Tue Oct 27 19:04:03 UTC 2015
On 10/26/2015 11:22 AM, Myth TV wrote:
> I know the right answer is to never modify the database directly, but I
> have done this in the past:
>
> Connect to the DB and then:
>
> INSERT INTO mythconverg.settings SELECT value,data,'<new frontend name>' FROM
> mythconverg.settings WHERE hostname = '<existing frontend name>';
To the OP
Further to this route, you can start by doing:
mysqldump -u mythtv -pmythtv --extended-insert --no-create-db
--add-drop-table --databases mythnew > junk
which will give you a complete text output of the *present* database.
grep -n 'hostname' junk
will show the lines where 'hostname' appears. You will find that you may
have up to a dozen tables which have a 'hostname' entry. Some of those
relate to hardware, but most are frontend settings.
You could copy each affected table's data into "newfile", do a
sed -i -e 's|oldhostname|newhostname|g' newfile,
(a global find and replace on the text file) and paste the amended file
back into "junk".
That would give the database the same settings for the 2 frontends
(things like profilegroups, and storagegroups may need to ba fixed anyway).
The settings table is a little more.... interesting, as it contains
entries specific to the backend, You should have no problems if the
backend is on another box, but if your base box is a BE/FE, a full
copy/amend/paste may confuse the machine....
When you are feeling lucky, you can do:
mysql -u mythtv -pmythtv mythnew < junk.
As you stated in the beginning, there is no easy way to do this.
There is especially no non-dangerous way to do this.
And of course, a good prophylactic step is to shave your head before
beginning. This will stop you from tearing your hair out later.
Geoff
More information about the mythtv-users
mailing list