카테고리 없음

ERROR 1822 (HY000) at line 100: Failed to add the foreign key constraint. Missing index for constraint 'FK_ShopReview_TO_Shop_Category_2' in the referenced table 'shopreview'

Canyi 2022. 12. 2. 11:18

ERD Cloud를 사용하여 작성한 erd

 

mysql에 node_project database(스키마) 생성을 하고 import

 

 

 

10:57:08 Restoring D:\NodeJsWebFront\importSQL\Nodejs5(Error1822).sql
Running: mysql.exe --defaults-file="C:\Users\piaoc\AppData\Local\Temp\tmp951z97rb.cnf"  --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=node_project  < "D:\\NodeJsWebFront\\importSQL\\Nodejs5(Error1822).sql"
ERROR 1822 (HY000) at line 100: Failed to add the foreign key constraint. Missing index for constraint 'FK_ShopReview_TO_Shop_Category_2' in the referenced table 'shopreview'

Operation failed with exitcode 1
10:57:09 Import of D:\NodeJsWebFront\importSQL\Nodejs5(Error1822).sql has finished with 1 errors

 

ERROR 1822 (HY000) at line 100: Failed to add the foreign key constraint. Missing index for constraint 'FK_ShopReview_TO_Shop_Category_2' in the referenced table 'shopreview'

이부분을 자세히 보면 

 

상점소개글이 부모이고 상점 카테고리가 자식이다. 그러므로 error를 보면 상점 카테고리의 회원 아이디가 unique하지 않는다고 뜬다. 그러므로 상점 카테고리 테이블에 있는 회원 아이디(FK) 아래와 같 삭제 

 

 

에러없이 성공적으로 IMPORT 완료