MySQL “ERROR 1005 (HY000): Can't create table 'foo.#sql-12c_4' (errno: 150)”

后端 未结 14 788
情深已故
情深已故 2020-12-03 04:13

I was working on creating some tables in database foo, but every time I end up with errno 150 regarding the foreign key. Firstly, here\'s my code for creating t

14条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 04:55

    I was using a duplicate Foreign Key Name.

    Renaming the FK name solved my problem.

    Clarification:

    Both tables had a constraint called PK1, FK1, etc. Renaming them/making the names unique solved the problem.

提交回复
热议问题