Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a MySQL Server and a phpMyAdmin in a server at office, I exported a database using the phpMyAdmin export feature. I come home and try to import the exported .sql and get this error:

-- -- Constraints for table product_detail_has_category -- ALTER TABLE product_detail_has_category ADD CONSTRAINT fk_product_detail_has_category_category1 FOREIGN KEY ( category ) REFERENCES category ( id ) ON UPDATE CASCADE , ADD CONSTRAINT fk_product_detail_has_category_product_detail1 FOREIGN KEY ( detail ) REFERENCES product_detail ( id ) ON UPDATE CASCADE ;

MySQL said: Documentation

1452 - Cannot add or update a child row: a foreign key constraint fails (kraken.#sql-6f3_141, CONSTRAINT

fk_product_detail_has_category_category1 FOREIGN KEY (category) REFERENCES category (id) ON UPDATE CASCADE)

what should I do in order to import the file without problems in my server?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.