Chimy's Program
ERROR 1822 (HY000): Failed to add the foreign key constraint. Missing index for constraint '~' in the referenced table '~' 본문
error
ERROR 1822 (HY000): Failed to add the foreign key constraint. Missing index for constraint '~' in the referenced table '~'
chimy 2020. 12. 31. 20:33Missing index for constraint '~' in the referenced table '~'

foreign key를 설정하려고 할 때 참조되는 테이블의 컬럼이 기본키(Primary Key)이거나 유니크 키(Unique Key)여야 하는데 설정이 안되었기 때문에 오류가 발생했다

해결1.

해당 컬럼을 유니크 키로 변경한다

정상적으로 외래키가 반영된다
'error' 카테고리의 다른 글
Comments