MySQL Forums :: InnoDB :: Foreign Key Error 121


Advanced Search

Re: Foreign Key Error 121
Posted by: Jim Maher ()
Date: April 17, 2009 09:54AM

I encountered this problem too, after "simplifying" my naming conventions on an experimental database. Problem occurred many times on many different tables.

Luckily, I found http://forums.mysql.com/read.php?22,33999,249437#msg-249437.

The simplified naming turned out to be the problem. Specifically, two foreign key constraints in two different tables wound up with the same name. Trying to create the second occurence fails.

I actually DID want them to be the same name. It's just a reference check. So, it would be convenient that all checks against table T001 from all other tables would be named something like fk_T001.

But that don't work.

When I renamed the foreign keys to be unique within this database, everything ran fine.

So, I guess the rule is that every foreign key constraint has to be a unique name?


Jim Maher

Options: ReplyQuote


Subject Views Written By Posted
Foreign Key Error 121 20601 Stephen Lynch 04/07/2006 08:35AM
Re: Foreign Key Error 121 5922 Heikki Tuuri 04/09/2006 01:38PM
Re: Foreign Key Error 121 6844 Stephen Lynch 04/10/2006 05:52AM
Re: Foreign Key Error 121 3607 Jim Maher 04/17/2009 09:54AM
Re: Foreign Key Error 121 4004 Heikki Tuuri 04/10/2006 07:06AM
Re: Foreign Key Error 121 3718 Stephen Lynch 04/10/2006 07:48AM
Re: Foreign Key Error 121 3322 Heikki Tuuri 04/10/2006 06:06PM
Re: Foreign Key Error 121 4552 Stephen Lynch 04/11/2006 09:08AM
Re: Foreign Key Error 121 3154 Heikki Tuuri 04/11/2006 02:49PM
Re: Foreign Key Error 121 3408 Nathan Alden 09/17/2007 05:54PM
Re: Foreign Key Error 121 5616 Noga Woronoff 09/26/2007 09:55AM
Re: Foreign Key Error 121 3013 Dave Page 07/07/2008 06:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.