约束Cannot add foreign key constraint条件
时间: 2023-11-15 15:51:33 浏览: 99
约束"Cannot add foreign key constraint"条件是在设置外键时,两张表的引擎都要保证是InnoDB。如果其中一张表的引擎不是InnoDB,就会出现该错误。\[3\] 这意味着如果你想要在两个表之间建立外键关系,你需要确保这两个表的引擎都是InnoDB。如果其中一个表的引擎是MyISAM或其他不支持外键的引擎,那么你将无法成功设置外键,会出现"Cannot add foreign key constraint"错误。\[1\] \[2\]
#### 引用[.reference_title]
- *1* *3* [解决1215 - cannot add foreign key constraint](https://blog.csdn.net/weixin_42297605/article/details/113718634)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Cannot add foreign key constraint全网唯一全面正解](https://blog.csdn.net/just_for_that_moment/article/details/126417025)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文