Mysql:外键错误

时间:2015-12-13 18:45:04

标签: mysql sql database

我使用的是mysql 5.5版。我有两个表,我想要添加外键constarint但不知何故我不断得到这个错误 - :

查询我执行:

alter table ptcact add foreign key(ptcid) references ptccitation(ptcid);

错误我收到:

ERROR 1005 (HY000): Can't create table 'ptc_journal.#sql-496_34' (errno: 150)

我的桌子:

  1. ptccitaionptcid为主键storage engine = MyIsam
  2. ptcactstorage engine=InnoDB

1 个答案:

答案 0 :(得分:1)

MyISAM不支持外键。

请参阅mysql docs