[mythtv-users] Database woes - Add a new entry

Michael T. Dean mtdean at thirdcontact.com
Wed Jun 26 15:09:51 UTC 2013


On 06/26/2013 10:42 AM, John Veness wrote:
> On 26/06/2013 15:36, James MacKenzie wrote:
>> Here's my story of woe...
>>
>> I made a backup of my linux box.  I was attempting to use it as a 
>> starting
>> point on another Myth box I was setting up for a relative.  During this
>> process, I got confused as to which machine I was on and did an 'rm
>> /usr/lib/mysql' on my good setup.
>>
>> I was able to go back and get everything working again by grabbing the
>> /usr/lib/mysql directory from the backup, but it had been made about 
>> 3 days
>> earlier.  During this time, about 5 programs were recorded.
>>
>> So, my question is, is there an easy way to get these entries into the
>> database?
>>
>> Thanks!
>
> You were lucky it was only five recordings in those three days!
>
> I think the usual answer is to view the "orphan" recordings in the 
> Video section, if you can identify the filenames and move the correct 
> files into your videos folder. Trying to artificially insert data into 
> the TV database tables is tricky and not supported. Note that this 
> will mean that Myth doesn't "know" it has recorded those particular 
> episodes and so may record them again if they're repeated, but that 
> isn't usually a big problem.

Right, and using find_orphans.py is the easiest way to identify the new 
recording files.
http://www.mythtv.org/wiki/Find_orphans.py

And, though it's a little to late for this time, before doing /anything/ 
with your MythTV setup, you should make a database backup (using 
http://www.mythtv.org/wiki/Database_Backup_and_Restore ) and put it in a 
safe place.  In fact, even just having a good database backup strategy 
(even if it's no more than just running the backup script once a day 
using a cron job at a time you're very unlikely to be recording) would 
have been very helpful in this case (where you seemed to have been 
working for several days before you made the mistake).

Also, FWIW, you should never use a copy of the MySQL data directory 
(with the MySQL binary data files) to "back up" your database.  Creating 
a proper backup is easy (with the script in the above-referenced wiki 
page); creates a single, compressed file for storage/transfer; and will 
/always/ work (whereas using binary data files may not work depending on 
MySQL versions and the specific procedures you used with those binary 
data files).  Note, though, that you should really use the backup script 
to create the backup because if you run mysqldump manually, you can 
create backups that will corrupt your schema if you ever end up 
restoring from them unless you know exactly which command-line arguments 
you must use and which ones you cannot use.

Mike


More information about the mythtv-users mailing list