When i have upload image from backend and save it but this image not saved bellow error display.

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (bisquehaus_db6.catalog_product_entity_media_gallery_value_to_entity, CONSTRAINT FK_A6C6C8FAA386736921D3A7C4B50B1185 FOREIGN KEY (value_id) REFERENCES catalog_product_entity_media_gall), query was: INSERT INTO catalog_product_entity_media_gallery_value_to_entity (value_id,entity_id) VALUES (?, ?) ON DUPLICATE KEY UPDATE value_id= VALUES(value_id),entity_id= VALUES(entity_id`)


enter image description here

How to solve it? Please help me?

  • did you ever find a solution to this?
    – zekia
    Jan 24, 2020 at 13:01
  • When I have repair our database then my issue was resolve
    – Devidas
    Jan 24, 2020 at 14:18

1 Answer 1


I repaired the Magento 2 database via CLI and my issue was resolved using below URL https://firebearstudio.com/blog/how-to-repair-magento-2-database.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.