生成MySQL数据库表报错:Error Code: 1022. Can't write; duplicate key in table '#sql-e88_23'

生成MySQL数据库表报错SQL:

alter table position add constraint FK_Reference_1 foreign key (partner_id)
      references partner (partner_id) on delete restrict on update restrict;

报错信息:

19:51:42    alter table position add constraint FK_Reference_2 foreign key (partner_id)       references partner (partner_id) on delete restrict on update restrict    Error Code: 1022. Can't write; duplicate key in table '#sql-e88_23'    0.047 sec

解决办法:修改外键名称,如下所示:

alter table position add constraint FK_Reference_8 foreign key (partner_id)
      references partner (partner_id) on delete restrict on update restrict;

猜你喜欢

转载自blog.csdn.net/daqiang012/article/details/82429647