0

I want add foreign key like this :

ALTER TABLE prepayment_log
ADD CONSTRAINT prepayment_log_modify_id_fk
FOREIGN KEY (modify_id) REFERENCES member (user_id) ON UPDATE CASCADE;

but SQL workbench output error code [HY000][1215]

I can sure that member (user_id) is varchar(50), also prepayment_log (modify_id) is varchar(50).

I don't know what is the problem. pls...

Johnny Wang
  • 23
  • 1
  • 5
  • Possible duplicate of [MySQL : ERROR 1215 (HY000): Cannot add foreign key constraint](https://stackoverflow.com/questions/18930084/mysql-error-1215-hy000-cannot-add-foreign-key-constraint) –  Jun 29 '18 at 04:07
  • I find the ans, because of user_id using unicode utf-8 defalt, and I using unicode utf-8 ci for modify_id – Johnny Wang Jun 29 '18 at 06:45

0 Answers0