I recently moved some tables to a new database. I left the foreign keys of these tables pointing to tables in the old DB.
I then created new versions of the referenced tables. I tried first to modify the FK so that they will point to the new references. That didn't work, so I dropped all old FKs and tried to create new ones. The first phase went through without a hitch. The second phase though failed with each and every table, in the same way! The response was always like:
ERROR 1452: Cannot add or update a child row: a foreign key constraint fails (`ml`.`#sql-d04_2`, CONSTRAINT `FK_excoeff_secID` FOREIGN KEY (`SecurityID`) REFERENCES `securities` (`SecurityID`))
The failure appears immediately and doesn't seem to relate to actual data. In the error message, as you can see, the place where the table name is usually located is now filled with a strange string. And no matter what the referring table is, the error contains the same string.
All that happend in the "Alter table" part of the MySQL WorkBench, but also as a regular SQL query.
Where did I go wrong???