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
報(bào)錯(cuò)百度一下就有, 應(yīng)該是數(shù)據(jù)類型或者約束不同的原因