问题
AFTER MySql restart i get the this error when I try to update or insert a row : #1452 - Cannot add or update a child row: a foreign key constraint fails.
The strange thing is that when I remove and add the key constraint again with phpMyAdmin the problem is gone. Also this I only have this problem with MAMP, not with WAMP, and also not on any other server until now. I use MySQL 5.5.9 , can anyone give a solution for this ? Thanks, Peter
回答1:
I had the same problem with MAMP :/ I don't know about the cause but "FLUSH TABLE" solved it.
来源:https://stackoverflow.com/questions/10363611/after-mysql-restart-1452-cannot-add-or-update-a-child-row-a-foreign-key-co