开发者

Problem with foreign key constraint

开发者 https://www.devze.com 2022-12-09 04:58 出处:网络
I am getting error #1005 - Can\'t create table (errno: 150). I have been through the checklist of: both tables are InnoDB

I am getting error #1005 - Can't create table (errno: 150).

I have been through the checklist of:

  • both tables are InnoDB
  • the columns are the same type (INT)
  • attributes are the same (UNSIGNED NOT NULL)
  • the collation开发者_如何学C is the same
  • I have tried with indexes on the foreign keys, it still doesn't work (and they shouldn't be needed for MySQL 5)


The problem was with my syntax. Instead of

REFERENCES `table`.`col`

it should be

REFERENCES `table` (`col`)

This question can be deleted.

0

精彩评论

暂无评论...
验证码 换一张
取 消