導入數據庫文件報錯 #1215 - Cannot add foreign key constraint
問題描述
SQL 查詢:
CREATE TABLE `blog_article` ( `id` int(4) NOT NULL AUTO_INCREMENT COMMENT '博文主鍵', `title` varchar(200) NOT NULL COMMENT '博文標題', `order` int(4) NOT NULL DEFAULT '0' COMMENT '排序', `content` text NOT NULL COMMENT '內容', `cat_id` int(4) NOT NULL COMMENT '所屬分類', `recommend` int(4) NOT NULL DEFAULT '1' COMMENT '是否推薦', `title_url` varchar(200) NOT NULL COMMENT '博文地址', `create_time` int(10) NOT NULL COMMENT '創建時間', `update_time` int(10) NOT NULL COMMENT '更新時間', PRIMARY KEY (`id`), KEY `cat_id` (`cat_id`), CONSTRAINT `blog_article_ibfk_1` FOREIGN KEY (`cat_id`) REFERENCES `blog_category` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8MySQL 返回: #1215 - Cannot add foreign key constraint
問題解答
回答1:
報錯百度一下就有, 應該是數據類型或者約束不同的原因
相關文章:
1. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. docker-compose中volumes的問題3. boot2docker無法啟動4. nignx - docker內nginx 80端口被占用5. docker安裝后出現Cannot connect to the Docker daemon.6. node.js - antdesign怎么集合react-redux對input控件進行初始化賦值7. docker容器呢SSH為什么連不通呢?8. java - SSH框架中寫分頁時service層中不能注入分頁類9. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?10. dockerfile - 為什么docker容器啟動不了?

網公網安備