[mythtv-users] Backend DB migration--replace or just restore?

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Jul 25 16:03:39 UTC 2020


On Sat, 25 Jul 2020 08:09:19 -0700, you wrote:

>I am replacing my Ubuntu 16.04 setup with a clean install of Myth on a
>clean install of Utuntu 20.04.  I have the old mythconverg backed up and am
>getting ready to restore.  The wiki backend migration page
><https://www.mythtv.org/wiki/Backend_migration> says "Depending on how your
>distribution initialises the database upon installation of the backend, you
>may need to use the procedure for replacing the database by the backup
><https://www.mythtv.org/wiki/Database_Backup_and_Restore#Replacing_an_existing_database>
>."
>
>The referenced page says: " If you are replacing an existing database with
>a known-good backup by using a full restore--for example, because your
>database has been corrupted or a database schema upgrade failed or you're
>replacing a package-provided database with your "old" database after
>re-installing your distro--you will need to drop the existing database. "
>
>I don't know how 20.04 initializes the DB.  I am not replacing the DB
>because of corruption or failed upgrade.  Do I run mythconverg_restore.pl
>with defaults or include the drop and create arguments?  Also to be clear,
>I should restore the DB after installing myth but before running setup,
>right?

You want to do a full restore with drop and create.  The other options
are for when you have a bad backup or partially corrupt database. When
you have a good backup of a full database, you always want to just
completely replace the existing database.

It does not matter if you want to run mythtv-setup first and play with
the empty database - anything you do will be overwritten with the
restored database.

You do want the MythTV packages installed before you restore your old
database.  The packages set up the database system so that restoring
databases will work.  See this file for the commands that get run to
set up the mythconverg database correctly:

/usr/share/mythtv/sql/mc.sql

If those commands are not run (if you create the mythconverg database
by restoring your backup before an existing mythconverg database has
been created), then the mythconverg database will not work correctly.
For example, its collating sequences will not be correct and data will
be listed and processed in the wrong order.  If you ever need to
manually create a mythconverg database, use the mc.sql file:

sudo mysql
source /usr/share/mythtv/sql/mc.sql
quit

Then a backup can be restored over the newly created mythconverg
database and it will work correctly.  This is part of what the
packages do when they are installed.

If you are copying your old config.xml files to the new system, then
you will need to run "sudo mysql" and do the necessary GRANT commands
to allow access using the user and password in the config.xml files.
Do that before restoring the old database - mythconverg_restore.pl
uses the config.xml files and restoring will fail if the config.xml
username/password does not match a GRANT.

After the restore, you immediately want to run mythtv-setup.  That
ensures that any database schema upgrades necessary to run with the
version of MythTV on the new system will get done.  If you are using
frontend only plugins like MythMusic, then you also need to run
mythfrontend to ensure they get schema upgrades done also.


More information about the mythtv-users mailing list