[mythtv-users] mythconverg_restore.pl: Duplicate entry for key 'PRIMARY'

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Mar 1 08:33:28 UTC 2015


On Sun, 01 Mar 2015 17:14:16 +1100, you wrote:

>
>Hi folks,
>
>I'm trying to migrate my database to a new back end, following the wiki.
>
>When I try to restore a backup on the new machine, I get this:-
>
>jon at newmedia:~$ sudo ./mythconverg_restore.pl  --drop-database --create-database --directory /home/jon --filename mythconverg-1317-20150301163436.sql.gz
>[sudo] password for jon:
>ERROR 1062 (23000) at line 2708: Duplicate entry '2684354578-0000-00-00 00:00:00--51-589824' for key 'PRIMARY'
>
>ERROR: Cannot write to mysql, stopped at ./mythconverg_restore.pl line 1720, <BACKUP> line 2709.
>jon at newmedia:~$
>
>This database is 10 years old, so I wouldn't be surprised if it has some cruft lying around. I have no idea how to fix this. I would appreciate any help.
>
>Cheers,
>
>Jon

I would try decompressing your backup file somewhere, for example:

cd ~
mkdir tempsql
cd tempsql
gzip -d /home/jon/mythconverg-1317-20150301163436.sql.gz

The .sql file is huge, but just a text file.  Then search it for the
duplicate key '2684354578-0000-00-00 00:00:00--51-589824':

grep "'2684354578-0000-00-00 00:00:00--51-589824'"
mythconverg-1317-20150301163436.sql

The .sql file is not formatted for human readability and has some very
long lines, so the grep output may not be easy to understand.


More information about the mythtv-users mailing list