[mythtv-users] How do I move an old database to an upgraded Back End (0.25 -- 0.27) SOLVED

Mike's JdJ stepsisters at comcast.net
Sat Sep 13 04:09:45 UTC 2014


On 09/12/2014 10:38 AM, Stephen Worthington wrote:
> On Thu, 11 Sep 2014 18:06:25 -0400, you wrote:
>
>>
>> How do I move an old database to an upgraded Back End (0.25 – 0.27)
>>
>> What I am trying to do is move my database from the old Back End
>> fixes/0.25(v0.25.2-15-g46cab93 (Ubuntu 10.4 32 bit) to a new
>> Back End 0.27.0+fixes .20140324.8ee257c-0 ubuntu3 (Ubuntu 12.04
>> 64 bit).
>>
>> The user and computer names are the same.
>>
>> I first tried compiling on the new Back End, but that failed.
>> Then I used the Ubuntu Software Center to install MythTV Front
>> End.  It prompted me for the database password and I used the
>> same one.  I see the Back End already running in System Monitor,
>> so I couldn't restore my old database before it ran configure.
>>
>> My backup copy of the MythTV 0.25 database does not have the
>> MySQL Time Zone Tables.  The 0.27 database should have them, but
>> does the database restore wipe them out?
>>
>>
>> Can I put my old database copy into /home and use the
>> mythconverg_restore.pl --directory /home/mythtv --filename
>> mythconverg-1214-20080626150513.sql.gz script?
>>
>>
>> I assume that I have to shut down the Back End first.  What is
>> the command for that in MythTV 0.27 fixes?
>>
>>
>> Mike
>
>
> Wiki page for database backup and restore:
>    http://www.mythtv.org/wiki/Database_Backup_and_Restore
>
> In Ubuntu now, mythbackend is a service configured by the file
> /etc/init/mythtv-backend.  So the command to stop it is:
>
>    stop mythtv-backend
>
> Such commands normally need to be done from a root prompt or using
> sudo.
>
> It is a while since I last did it, but I believe the proper procedure
> for upgrading a database on a new system with the same hostname is:
>
> 1) Do a full install of MythTV with all the plugins you had on your
> old setup.
>
> 2) stop mythtv-backend
>
> 3) From a copy of the /etc/mythtv/config.xml file from the old system,
> copy the database password to the same file on the new system, and
> also into /home/mythtv/.mythtv/config.xml and /home/<mythtv
> user>/.mythtv/config.xml if they exist.
>
> 4) Do a full restore of the old database - including dropping the
> existing database:
>
>    /usr/share/mythtv/mythconverg_restore.pl --drop_database
> --create_database --filename <backup database file name>
>
> If the backup database file you are restoring from is not in the
> current directory, then add the option
>
>    --directory <where the backup database is>
>
> I normally run mythconveg_restore.pl from a root prompt, in which case
> it does not matter where the database to be restored is, as root will
> have access to it.
>
> 3) Follow the procedure for loading the timezone tables into MySQL
> from here:
>
>    http://www.mythtv.org/wiki/MySQL_Time_Zone_Tables
>
> You may find that this is already done.
>
> 5) Run mythtv-setup via the menu option (so it runs as your mythtv
> user, rather than as root).  Or run it from a command prompt run from
> your MythTV user account.  Running mythtv-setup (rather than
> mythbackend) is the best way to trigger the database upgrade to take
> place.  If you have a large database, the upgrade process may take a
> few minutes.  I believe it will also first create a backup of the
> database before it upgrades it, which takes a while also.  Make sure
> that process will not overwrite your copy of the old database.  You
> can track what it is doing somewhat by looking at its log file, for
> example, use this command from a prompt once mythtv-setup is running:
>
>    tail -f /var/log/mythtv/mythtv-setup.log
>
> Wait for the upgrade process to complete and the mythtv-setup menu to
> appear, then exit mythtv-setup.  Or make any tuner changes that you
> need to on the new system, then exit.
>
> 6) start mythtv-backend
>
> 7) Run mythfrontend in the usual way.  If you have plugins that have
> their own database tables such as mythmusic, go into each one to make
> sure that they update their tables.
>
> Should something go wrong in the above procedure, it can be repeated
> as many times as necessary from 4) onwards until you get it to work.
> _______________________________________________
>


Stephen, you are my hero!  Thanks for the information.  I have 
now retired my old MythTV system disc that has 4.9 years of 
operation on it (WD Caviar Blue).

My upgrade did not go exactly according to your recommendations, 
but it is successful.  I will share the steps here for others.

This is for my particular migration:  Ubuntu 12.04 32 bit MythTV 
fixes 0.25 to Ubuntu 14.04 64 bit MythTV 0.27 fixes; same Ubuntu 
device name, user name, password.  I used the same MySQL 
database password.


Preparation

I made screen captures of each MythTV configuration page just in 
case (I'm an old IT guy).

I made sure that MythTV was not doing any recordings, Schedules 
Direct downloads, or file purging.  I shut down the BackEnd to 
release any DB items it had open.

sudo stop mythtv-backend
(sudo was what was missing from the documentation I looked at 
before Stephen's reply) I used Ubuntu System Monitor to watch 
the Myth process end.

./mythconverg_backup.pl --verbose  (make a copy of the database)
I made a copy of the DB backup script in my home folder (yeah, I 
know).

My backup directory configuration is default, so I found the DB 
backup file, mythconverg-1299-20140912144820.sql.gz in this 
path: root/var/lib/mythtv/db_backups.  I copied the file to one 
of my recordings disc drives.

My /etc/mythtv/config.xml was zero-length (!). I looked for 
/home/mythtv/.mythtv/config.xml and 
/home/<mythtv/user>/.mythtv/config.xml without success.  I did 
grab a copy of /etc/mythtv/mysql.txt which had the DB password 
in it.

I copied Stephen Toth's great firmware (/lib/firmware) for my 
Hauppauge HVR-2250 tuners so I wouldn't have to download and 
unzip it again.

I copied root/etc/fstab, so I could copy my four recordings 
discs UUIDs into the new fstab.

I will create a new SSL key for rsync.

I removed the old system disc and installed the new system disc 
that I previously installed Ubuntu 14.04 64 bit, then installed 
all the Ubuntu updates.  I then used the Ubuntu Software Center 
to install MythTV FrontEnd (0.27 fixes). The install program 
created the MySQL DB and started the BackEnd.

sudo stop mythtv-backend

I copied the  mythconverg-1299-20140912144820.sql.gz file into 
the home folder.

sudo su  (become super user)

/usr/share/mythtv/mythconverg_restore.pl --drop_database 
--create_database --directory /home/myusername --filename 
mythconverg-1299-20140912144902.sql.gz
(I had to specify --directory as well as the --filename options)

mysql --password mythconverg
(This is to check for updated time zone tables, prompt for DB 
password)

mysql> SELECT CONVERT_TZ(NOW(), 'SYSTEM', 'Etc/UTC');
+----------------------------------------+
| CONVERT_TZ(NOW(), 'SYSTEM', 'Etc/UTC') |
+----------------------------------------+
| 2014-09-12 20:32:45                    |
+----------------------------------------+
1 row in set (0.00 sec)

mysql> exit

sudo start mythtv-backend


Leave terminal and on the Ubuntu desktop launch:

MythTV Backend Setup

(add myusername to mythtv group)

(myusername log out and log in)

(Database Configuration 1/2  Password: NEW mythtv password

"Warning: MythTV wants to upgrade your database, for the TV 
schema, from 1299 to 1317."

Make another DB backup (you don't want to do this conversion 
again, do you?)

Enjoy!

Thanks very much to the developers and supporters.  I think that 
MythTV makes Windows Media Center look pathetic!



More information about the mythtv-users mailing list