MySQL. Can't create table errno 150

前端 未结 22 1381
广开言路
广开言路 2020-12-01 09:59

I have to create a database with two tables in MySQL, but the script fails with errno 150 (foreign key problem). I double-checked the foreign key fields to be the same on bo

22条回答
  •  日久生厌
    2020-12-01 10:48

    I had a similar error on one of my tables. When checked column Collation was different, which worked once changed both columns to the same Collation type.

    After reading most of the suggested solution here. I just thought it might be helpful if I just list down all the possibilities which could throw this error.

    1, Check CASE of the Column 2, Check COLLATION of Columns 3, Check if there is a key created in both tables for the column (Unique, Primary)

提交回复
热议问题