当我尝试导入数据库时??出现此错误
SQL query:
ALTER TABLE `bid`
ADD CONSTRAINT `bid_ibfk_4` FOREIGN KEY (`auction_contact_id`) REFERENCES `auction_contact` (`auction_contact_id`),
ADD CONSTRAINT `bid_ibfk_3` FOREIGN KEY (`car_id`) REFERENCES `car` (`car_id`)
MySQL said: Documentation
#1826 - Duplicate foreign key constraint name 'projekt_classics/bid_ibfk_3'
查看所有外键,我得到的结果
select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_TYPE = 'FOREIGN KEY'
结果
def projekt_classics bid_ibfk_2 projekt_classics bid FOREIGN KEY
def projekt_classics bid_ibfk_3 projekt_classics bid FOREIGN KEY
def projekt_classics car_ibfk_1 projekt_classics car FOREIGN KEY
def projekt_classics car_ibfk_3 projekt_classics car FOREIGN KEY
def projekt_classics car_ibfk_4 projekt_classics car FOREIGN KEY
def projekt_classics car_brand_ibfk_1 projekt_classics car_brand FOREIGN KEY
搜索sql中的bid_ibfk_3约束仅显示1次.
所有数据都在导入的数据库中,但我想知道如何避免此错误.
编辑:
首先删除所有表将运行查询而不会出现问题.
我使用PHPmyadmin导出数据库.
我猜该错误是由于尝试再次创建外键约束之前尚未将其删除.