mysql version 5.5.27 report [Err] 1005 - Can't create table 'hgwechat-ms.customer_news' (errno: 150) -


i have 3 existed tables:"customer" "news" "hallplace",here code how create them:

drop table if exists `customer`; create table `customer` (   `id` varchar(32) collate utf8_bin not null,   ...   primary key (`id`),   ... ) engine=innodb default charset=utf8 collate=utf8_bin;  drop table if exists `news`; create table `news` (   `id` varchar(32) not null,   ...   primary key (`id`),   ... ) engine=innodb default charset=utf8;  drop table if exists `hall_place`; create table `hall_place` (   `id` varchar(32) not null,   ...   primary key (`id`),   ... ) engine=innodb default charset=utf8; 

now need create new table "customer_news":

create table `customer_news` (   `id` varchar(32) collate utf8_bin not null,   ..   `fk_customer_id` varchar(32) collate utf8_bin default null,   `fk_news_id` varchar(32) collate utf8_bin default null,   `fk_hallplace_id` varchar(32) collate utf8_bin default null,   primary key (`id`),   key `fk8037fe9466e72c39` (`fk_customer_id`),   key `fk8037fe94b522885d` (`fk_news_id`),   key `fk8037fe94255be4d0` (`fk_hallplace_id`),   constraint `fk8037fe94255be4d0` foreign key (`fk_hallplace_id`) references `hall_place` (`id`),   constraint `fk8037fe9466e72c39` foreign key (`fk_customer_id`) references `customer` (`id`),   constraint `fk8037fe94b522885d` foreign key (`fk_news_id`) references `news` (`id`) ) engine=innodb default charset=utf8 collate=utf8_bin; 

it's work on mysql version5.6,but on mysql 5.5,error shows:

[err] 1005 - can't create table 'hgwechat-ms.customer_news' (errno: 150)

^_^ first time using stackworkflow,i dont konw how format.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -