Error when importing database file #1215 - Cannot add foreign key constraint
Silvano
Silvano 2020-12-03 06:59:24
0
1
1578

SQL query:

CREATE TABLE `blog_article` ( `id` int(4) NOT NULL AUTO_INCREMENT COMMENT 'Blog post primary key', `title` varchar(200) NOT NULL COMMENT 'Blog post title', ` order` int(4) NOT NULL DEFAULT '0' COMMENT 'Sort', `content` text NOT NULL COMMENT 'Content', `cat_id` int(4) NOT NULL COMMENT 'Category', `recommend` int(4) NOT NULL DEFAULT '1' COMMENT 'Whether it is recommended', `title_url` varchar(200) NOT NULL COMMENT 'Blog post address', `create_time` int(10) NOT NULL COMMENT 'Creation time', `update_time` int(10) NOT NULL COMMENT 'Update time', 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 returns: #1215 - Cannot add foreign key constraint

Silvano
Silvano

reply all(1)
1900

image.png

The error will be reported in Baidu immediately. It should be due to different data types or constraints

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template