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