Skip to content Skip to sidebar Skip to footer

Getting Error 1822 In Mysql When Trying To Create A Foreign Key

I am getting an error when creating a foreign key. The error is 1822 and it says the following: Error Code: 1822. Failed to add the foreign key constraint. Missing index for const

Solution 1:

In the referencing table, there must be an index where the foreign key columns are listed as the first columns in the same order dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html in your example you have no such key in recipe for alter table Changes add foreign key(version) references Recipe(version


Post a Comment for "Getting Error 1822 In Mysql When Trying To Create A Foreign Key"