ERROR 1217 (23000) at line 730: Cannot delete or update a parent row: a foreign key constraint fails

MySQL庫中有倆表,table1和table2,相互關聯,在刪除表的時候出錯: 很明顯這是表關聯生成的強制約束問題,在刪除的時候回檢查表之間的關聯關係,從而致使沒法刪除。mysql 解決辦法:web SET foreign_key_checks = 0; // 先設置外鍵約束檢查關閉 drop table table1; // 刪除表,若是要刪除視圖,也是如此 SET foreign
相關文章
相關標籤/搜索