MySQL

[MySQL] Error Code: 3780 해결

kyeee2 2022. 5. 21. 17:14

에러 내용:

Error Code: 3780. Referencing column 'writer' and referenced column 'id' in foreign key constraint 'fk_notice_userinfo1' are incompatible.

 

원인/해결:

userinfo 테이블을 생성할 때, 아래와 같은 속성을 사용하여 생성했는데

DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci

notice 테이블을 생성할 때는 저걸 사용하지 않아서 character set과 collate 을 추가해주지 않아서였다.

 

테이블을 생성할 때 추가해주니 테이블 생성이 되었다!