Mysql create table Error:1005

来源:互联网 发布:物理仿真实验室软件 编辑:程序博客网 时间:2024/06/08 15:47

I realize this is an old post, but it ranks high in Google, so I'm adding what I figured out for MY problem. If you have a mix of table types (e.g. MyISAM and InnoDB), you will get this error as well. In this case, InnoDB is the default table type, but one table needed fulltext searching so it was migrated to MyISAM. In this situation, you cannot create a foreign key in the InnoDB table that references the MyISAM table.

这是一个问题,也就是说需要添加成

Create table sentiment_April(
id int  primary key auto_increment,
sentiment float ,
tweet_id bigint(20), 
CONSTRAINT fk_PerOrders FOREIGN KEY (tweet_id)
REFERENCES tweets_April(tweet_id)
)ENGINE=MyISAM;

或者

Create table sentiment_April(
id int  primary key auto_increment,
sentiment float ,
tweet_id bigint(20), 
CONSTRAINT fk_PerOrders FOREIGN KEY (tweet_id)
REFERENCES tweets_April(tweet_id)
)ENGINE=InnoDB;

0 0
原创粉丝点击