2020年12月3日

ERROR 1215 (HY000): Cannot add foreign key constraint

摘要: alter table 表名字 add constraint fk_当前表_关联表 foreign key(列) references 另一个表(列); 添加外键约束时报错,原因是两张表的字符集不一致, 查看字符集show create table 表名; 到这里问题还没得到解决,发现,列的字符集也 阅读全文

posted @ 2020-12-03 17:41 刀锋93 阅读(263) 评论(0) 推荐(0)

ERROR 1062 (23000): Duplicate entry '123' for key 'uk_user'

摘要: 在给表user添加唯一约束unique报的错 添加唯一约束的语句:alter table user add constraint uk_user unique (username); 原因:在给username添加唯一约束时,username的值含有重复的,“123”,因此失败。 阅读全文

posted @ 2020-12-03 16:34 刀锋93 阅读(444) 评论(0) 推荐(0)

导航