Whenever you get an INNODB error, you can get more details by running a SHOW INNODB STATUS.
A foreign key means that a value must exist in one table before it can be used as a value in another table. That's probably why you couldn't add a record to Table2 before you had a value in Table1. The child table of a foreign key is also required to have an index on the column that is referencing the foreign value. That means that you had to declare either a Key(memberID), a UNIQUE(memberID), or a PRIMARY KEY(memberID) before memberID could participate in a FK relationship. As to why you cannot drop the foreign key from Table2, you will have to look at the error's details in the SHOW INNODB STATUS results. Shawn Green Database Administrator Unimin Corporation - Spruce Pine Stuart Felenstein <[EMAIL PROTECTED]> wrote on 10/03/2004 10:17:36 AM: > I think I may have discovered one of my issues, is > memberID in Table2 was primary key. Should not have > been. As far as the error messages in removing key, > I'm still unsure. > > Stuart > --- Stuart Felenstein <[EMAIL PROTECTED]> wrote: > > > Two tables: > > > > Table1 [innodb] > > userID..... > > addtlfields..... > > > > Table2 [innodb] > > memberID..... > > addtlfields..... > > > > I created a foreign key in Table2 for memberID to > > userID > > set to "no action" on both delete and update. > > > > I get this error when I try to add a record to table > > 2:"Cannot add or update a child row: a foreign key > > constraint fails" > > > > I try and remove the foreign key and it won't let > > me: > > > > 1025-Error on rename of './mydatabase/table to > > './mydatabase/#sql2-695b-c4ac0'(errno: 152) > > > > I think can probably forgoe the foreign key , but > > what's with all the error messages ? > > > > Thank you, > > Stuart > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: > > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] >