[1822] MYSQL 에러 추적 Failed to add the foreign key constraint
해당 에러는 FK 로 묶으려고 하는 테이블의 문제가 아닌 기존의 테이블의 Unique Key, Primary Key 가 설정되어 있지 않은 경우 발생하는 에러입니다. 예를 들어 다음과 같이 테이블이 2개가 존재한다고 가정해봅니다. create table A ( keycolumn1 bigint not null auto_increament, created_at datetime(6), primary key (keycolumn1) ) create table B ( keycolumn2 bigint not null auto_increment, foreign bigint, created_at datetime(6) ) alter table B add constraint fk_b_to_a foreign key (fore..
Server
2022. 4. 16. 18:34
공지사항