Magento2产品导入报错Category " has not been created. URL key for specified store already exists

  1. Category " has not been created. URL key for specified store already exists. in row(s): 1
    General system exception happened

Additional data:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (mg2db.catalog_category_product, CONSTRAINT CAT_CTGR_PRD_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID FOREIGN KEY (category_id) REFERENCES catalog_category_entity (entity_id) ON DELETE CASCADE), query was: INSERT INTO catalog_category_product (product_id,category_id,position) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE product_id = VALUES(product_id), category_id = VALUES(category_id)

群友csv产品导入报错。
经过我测试发现是他之前把默认root分类名改了,而csv又没有更改。导致csv会创建新子目录,而新子目录url又重复,而导致的报错。
解决办法:
1.修改csv文件,重新修改目录名。
2.把root分类改回去。
打完收工。