If somehow (f.e. because of a migration from DAM to FAL) you face with duplicate records in MM table you need a small trick to be able to delete them.
The solution is quite simple:
ALTER TABLE sys_category_record_mm ENGINE MyISAM;
ALTER IGNORE TABLE sys_category_record_mm ADD UNIQUE KEY uidx(uid_local, uid_foreign, tablenames);
ALTER TABLE sys_category_record_mm ENGINE InnoDB;
With this MySql command deletes the server all duplicates but only one line.
The change in the database engine is needed because of a bug in specific InnoDB versions. See http://bugs.mysql.com/bug.php?id=40344