我写的SQL语句:alter table `cont`(constraint `fk_id` foreign key(`id`) references `user` (`id`));主表是user表,附表是cont表,小弟想把两个表的ID字段关联上,可报错
ERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(constraint `fk_id` foreign key(`id`) references `user` (`id`))' at line 1是怎么回事啊????上网查没有好结果,急死了~~~~~~~~~~~~~先谢谢大家哈哈
ERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(constraint `fk_id` foreign key(`id`) references `user` (`id`))' at line 1是怎么回事啊????上网查没有好结果,急死了~~~~~~~~~~~~~先谢谢大家哈哈
ser` (`id`);
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0[/code]
我查看了一下表设计里,好像没有成功的迹象,呵呵
我在Console里执行的。
是引擎问题
添加 引擎 type=innodb;