Short Stack: Keep Calm and Restore Your MythTV database

TL;DR

mythconverg_restore.pl --drop_database --create_database --directory /where/file/is --filename mythconverg-backup-file.sql.gz

Introduction

While I pay for TV, I often find that my schedule and TV locations doesn’t always coincide with that of my shows.  So after exploring various solutions, I’ve been a happy user of MythTV for a few years now.  Yes, it can be overly complicated at times and yes it took quite a bit of finagling to get set up initially, but most of the finagling was to get it running on a Raspberry Pi, which is also one of the reasons it works out so well for me, so here we are.

The Problem

I had been running MythTV on a Raspberry Pi 2 for a few years, and it was rock solid.  Had an external hard drive hooked up for storage and happily used it day in and day out.  My only complaint was that playback of a show that was currently being recorded would get pretty choppy, but those use cases were few and far between.  So when I got my hands on a Pi3, I figured this would be a good time to upgrade the Myth setup (or potentially expand it to having multiple backends).  However, when I got the MythTV backend set up on the new Pi and fired it up, it automatically located my existing backend and wanted to use that.  I guess this would have been fine, except that the MySQL schema had apparently changed and the software wanted to automatically update it for me, great! Well no, actually it broke everything.  Both the new backend and the old backend had managed to get corrupted and neither worked well.  I decided I should get the Pi3 set up as an independent backend cause I suspected it would be capable on it’s own, but in the meantime I needed to get the existing system functioning again.

The Solution

Luckily the very informative message that was presented from Myth told me it would back up my current database (phew) so it was simply a matter of restoring it, which Myth also provides a utility for.  First identify the directory the backup was stored in, the name of the backup, and the location of the mythconverg_restore.pl script, then navigate to the script.  Once there execute the command from the TL;DR section above, replacing the directory and filename parameters with the values you identified already. The drop_database and create_database options are there because in my case the database had been fully corrupted, so the whole database had to be restored, not just the contents of it.  After that had completed, my existing backend was back up and running like nothing had happened and I was able to set the new one up independently, and eventually transition over.  In the event you’ve been a little too trigger happy with your Myth setup, I hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *