Question #5793
Submitted by Answiki
on 01/25/2022 at 06:08:44 PM UTC
#1215 - Cannot add foreign key constraint, why this error?
Merged questions
Answer
Submitted by Answiki
on 01/25/2022 at 06:10:34 PM UTC
#1215: Cannot add foreign key constraint
The above MySQL error #1215 can occur for one of the several reasons:
- You are trying to reference a key that does not exist in the external table.
- The columns are not of the same type (for example,
INTto BIGINT, UNSIGNED INTto INT...). To create a relationship between two tables, the columns concerned must be strictly of the same type. - Tables are not of the same type (for example, InnoDB to MyISAM). To create a relationship between two tables, they must be of the same type.
Answer by Answiki on 01/25/2022 at 06:10:34 PM
#1215: Cannot add foreign key constraint
The above MySQL error #1215 can occur for one of the several reasons:
- You are trying to reference a key that does not exist in the external table.
- The columns are not of the same type (for example,
INTto BIGINT, UNSIGNED INTto INT...). To create a relationship between two tables, the columns concerned must be strictly of the same type. - Tables are not of the same type (for example, InnoDB to MyISAM). To create a relationship between two tables, they must be of the same type.
Question by Answiki 01/25/2022 at 06:08:44 PM
#1215 - Cannot add foreign key constraint, why this error?
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 12973 | en | https://en.ans.wiki/5793/1215-minus-cannot-add-foreign-key-constraint-why-this-error | 4 |
Icons proudly provided by Friconix.