When I wan't to connect two tables with eachother then I get the message : #1452 - Cannot add or update a child row: a foreign key constraint fails....I want to connect oauth_uid2 (primary key) from the facebook_users tabel to the bugs tabel with the foreign key oauth_uid2. But I get always this message. I have already cleared my data but nothing works.Also in the table users_facebook I have 1 record.
1452 - Cannot add or update a child row: a foreign key constraint fails (phples
.bugs
, CONSTRAINT bugs_ibfk_1
FOREIGN KEY (oauth_uid2
) REFERENCES users_facebook
(oauth_uid2
) ON DELETE CASCADE ON UPDATE CASCADE)
bugs table: FK = oauth_uid2, PK= bug_id
#Name Type Collation Attributes Null Default Extra Action
1 bug_id int(30) No None AUTO_INCREMENT Change Drop Browse distinct values Primary Unique Index Spatial Fulltext
2 bugtitle varchar(50) utf8_unicode_ci No None Change Drop Browse distinct values Primary Unique Index Spatial Fulltext
3 bugdescription varchar(500) utf8_unicode_ci No None Change Drop Browse distinct values Primary Unique Index Spatial Fulltext
4 oauth_uid2 int(30) No None Change Drop Browse distinct values Primary Unique Index Spatial Fulltext
users_facebook table: PK= oauth_uid2
# Name Type Collation Attributes Null Default Extra Action
1 oauth_uid2 int(30) No None Change Drop Browse distinct values Primary Unique Index Spatial Fulltext
2 email varchar(70) utf8_unicode_ci No None Change Drop Browse distinct values Primary Unique Index Spatial Fulltext
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…