我有2个表。Mysql表关系和不能添加外键它显示不能创建
manifast
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| manifast_id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| description | text | NO | | NULL | |
| title | text | NO | | NULL | |
+-------------+------------------+------+-----+---------+----------------+
day_sequence;
+-----------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+------------------+------+-----+---------+----------------+
| day_sequence_id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| day_number | int(11) | NO | | NULL | |
| day_start | int(11) | NO | | NULL | |
| manifast_id | int(11) | NO | | NULL | |
+-----------------+------------------+------+-----+---------+----------------+
4行集(0.00秒)
我想连接这些两列,并使用该命令。
ALTER TABLE day_sequence
ADD CONSTRAINT fk_manifast
FOREIGN KEY (manifast_Id)
REFERENCES manifast(manifast_Id);
它显示此错误。我可以如何解决?
无法创建指定的关系。
MySQL表示:无法创建表 'projectX创建SQL#-3e0_4。'(错误:150)
这些表使用什么表存储引擎?你可以发布SHOW CREATE TABLE表单和SHOW CREATE TABLE day_sequence的输出吗? –
可能重复的[MySQL创建表使用外键提供errno:150](http://stackoverflow.com/questions/1457305/mysql-creating-tables-with-foreign-keys-giving-errno-150) – AndySavage