Note: I did data migration couple of times, during data migration max_allowd_packet issue then update and again run the data migration.
How to solve the php bin/magento setup:upgrade error, If i try to run upgrade command i am getting following error,
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '21' for key 'PRIMARY', query was: INSERT INTO eav_attribute_set (entity_type_id, attribute_set_name, sort_order, attribute_set_id) VALUES (?, ?, ?, ?)
Table : eav_attribute_set https://snipboard.io/rUicuR.jpg
Queries :
SELECT * FROM eav_attribute_set WHERE attribute_set_id = '21';
SELECT * FROM eav_attribute_group WHERE attribute_set_id = '21';
How to solve this error?
Hi @Aveeva
In your case Edit that row, you will see there is more than 1 entry (here 21), just remove all other duplicates values from there and save it.
Flush cache and re-run index command.
php bin/magento cache:flush php bin/Magento indexer:reindex
Or you can take reference from below link:
https://magento.stackexchange.com/questions/216720/sqlstate23000-integrity-constraint-violation-1062...
It may help you!
Problem Solved? Please click on 'Accept as Solution!'
@Bhanu Periwal From the table eav_attribute_set,
Screenshot : https://snipboard.io/rUicuR.jpg
What are all the values should be delete? Thanks
@Bhanu Periwal I just looking some other forums also, still looking solution, may i know what values i need to delete in this https://snipboard.io/rUicuR.jpg
Hi @Aveeva
Please take a backup of your database first.
Then do suggested solutions. Yes you need to delete duplicate entries from table. Which is only way to resolve this issue.
Thank you.
Hi @Aveeva ,
Did you try your data migration command with --reset parameter.?
I found something related to your issue: can you also try the same if possible.
https://magento.stackexchange.com/questions/258209/magento-2-how-can-i-reset-the-data-migration-tool
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solution!