Want to install MythTV onto a new system, or install things from scratch on the same system? The big problem is loosing all your recordings and data.
It not as simple as just copying your recording files over. You need to have the database information about each file for them to work.
It's fairly easy to transfer your important database information to a new server. Here's how.
Migrate your MythTV recordings in 3 easy steps:
- Backup the important database information from the old database
- Copy the files into the new install directory
- Restore the database information into the new database
Step 1 - Backup your existing data
I've seen a couple different ways to do this in the MythTV documentation, both of which seem a little awkward. I think I have a better way, which has worked fine for me once.
Basically what we need to do is export the information about the existing recordings, previous recordings, and future recordings. This data will be imported into an already setup database on the new system.
mysqldump -u mythtv -p -t mythconverg record recorded \ oldrecorded recordedprogram recordedrating \ recordedmarkup recordedseek > recordings.sql
That's all a single command that needs to be run on the command line. If you use a different database user, substitue your username in place of "mythtv" after the -u argument. If you use a different database name, replace mythconverg with your database name.
That command, after prompting for your database password, will export all the data you need to migrate into a file name recordings.sql. This is the file you will need to import on the new server when we get to that step. How to copy the file will be an exercise for you to figure out, since each situation may be different.
Step 2 - Copy your video files to the new MythTV recordings directory
Again, each situation may be different in terms of copying files over.
One tip is to find where you think they are going to be recorded, then start recording a show to see if a file shows up there. If a file shows up in that directory then you've got the right place. Copy all your video files over.
This may take a while if you are going between drives or over a network, but you can import the database records while files are copying. When I migrated to a new system, it took about 8 hours to copy all my recordings over the network.
Until everything is copied over, you will just get an error if you try to watch a recording that hasn't been copied yet if you go ahead and import the recording data.
Step 3 - Import the recording data into the new database
Start by copying the recordings.sql file to the target server if it's not already there. Then all we need to do is import it to the target database.
mysql -u mythtv -p mythconverg < recordings.sql
Provide your password, and the recording data will be imported.
Watch Your MythTV Recordings
That's it. If everything went as planned, all your recording will be in your new system as if nothing had changed.


2 Easy steps instead of 3...
In step 1, instead of creating the recorded.sql file, you can send the output of the sql query directly into the new database by piping it into another mysql command line.
From the NEW server's command line do:
newserver # mysqldump -h oldserverIP -umythuser -pmythpass mythconverg \
record recorded oldrecorded recordedprogram recordedrating \
recordedmarkup recordedseek | \
mysql -umythuser -pmythpass mythconverg
Hope this helps. :)
--
Bill Arlofski
MySQL Pipe
Bill's correct. I presented it this way because in many cases, and mine in particular, you might not have access to both databases at the same time.
Thanks Bill, I appreciate your feedback.
moving among different versions
In case you're moving recordings to a different version of MythTV where the database layout has changed, you'll get an import error if the number of columns doesn't match.
You can work around that by adding the "-c" (--complete-insert) option to mysqldump when exporting the files. It'll leave the missing column(s) blank, but at least you'll be able to import the data.
Moving files
thanks!
Thanks for this information! It helped me a great deal. Here's my one piece of advice in case others encounter this problem. I attempted to transfer recordings from an existing mythtv installation to another--which had already made some recordings. When I tried to run "mysql" to import the old database into the new, I got the following error:
ERROR 1062 (23000) at line 24: Duplicate entry '18' for key 1So, I added "-f" to the mysql command, to force the import (and ignore any errors). eg:
mysql -f -u mythtv -p mythconverg < recordings.sqlThis error was still reported, but the rest of the import appeared to work. I suspect that one of my recordings (at entry 18) did not get imported, but that's ok.
Anyhow, thanks for this website. It's a great resource.