導(dǎo)入數(shù)據(jù)庫(kù)文件報(bào)錯(cuò) #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 '博文標(biāo)題', `order` int(4) NOT NULL DEFAULT '0' COMMENT '排序', `content` text NOT NULL COMMENT '內(nèi)容', `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 '創(chuàng)建時(shí)間', `update_time` int(10) NOT NULL COMMENT '更新時(shí)間', 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:報(bào)錯(cuò)百度一下就有, 應(yīng)該是數(shù)據(jù)類型或者約束不同的原因
相關(guān)文章:
1. python文檔怎么查看?2. python - pycharm 自動(dòng)刪除行尾空格3. 安全性測(cè)試 - nodejs中如何防m(xù)ySQL注入4. python - pandas按照列A和列B分組,將列C求平均數(shù),怎樣才能生成一個(gè)列A,B,C的dataframe5. python - Pycharm的Debug用不了6. html - eclipse 標(biāo)簽錯(cuò)誤7. python 利用subprocess庫(kù)調(diào)用mplayer時(shí)發(fā)生錯(cuò)誤8. 請(qǐng)問PHPstudy中的數(shù)據(jù)庫(kù)如何創(chuàng)建索引9. datetime - Python如何獲取當(dāng)前時(shí)間10. javascript - 有適合開發(fā)手機(jī)端Html5網(wǎng)頁(yè)小游戲的前端框架嗎?
