导入数据库文件报错 #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. golang - 用IDE看docker源码时的小问题2. debian - docker依赖的aufs-tools源码哪里可以找到啊?3. macos - mac下docker如何设置代理4. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?5. docker start -a dockername 老是卡住,什么情况?6. docker pull 错误?7. mac连接阿里云docker集群,已经卡了2天了,求问?8. mac里的docker如何命令行开启呢?9. docker-compose 为何找不到配置文件?10. dockerfile - 为什么docker容器启动不了?