Error Code: 1215. Cannot add foreign key constraint
来源:2-3 实体类设计与表创建B
慕仰8442947
2019-03-27
CREATE TABLE o2o.tb_wechat_auth (wechat_auth_idint(10) NOT NULL AUTO_INCREMENT,user_idint(10) NOT NULL,open_idvarchar(1024) DEFAULT NULL,create_timedatetime DEFAULT NULL,
primary key(wechat_auth_id),
constraint fk_wechatauth_priofile foreign key(user_id) referencestb_person_info(user_id)
)ENGINE InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8
写回答
1回答
-
同学可以按照链接逐步排查1215错误码的问题
https://blog.51cto.com/yntmdr/1874386
如果不行,可以尝试把user_idint(10) NOT NULL, 改成 user_idint(10) ,先试试
022019-04-27
相似问题