Answer the question
In order to leave comments, you need to log in
Errors when importing a mysql database dump - how to fix it?
I am transferring the database from one server to another, the database is quite large, at the very end errors begin.
I suspect that the problem may be due to the fact that on the source server from which the dump was exported, mysql8 is installed, and on the server where I import - mariadb. If I copy base on the same server, there are no errors.
Exporting just mysql - u user -p dbname < dump.sql
First error:
ERROR 1062 (23000) at line 9002953: Duplicate entry 'default-0-amasty_elastic/catalog/query_settings' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH'
(ALTER TABLE `core_config_data`
ADD PRIMARY KEY (`config_id`),
ADD UNIQUE KEY `CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH` (`scope`,`scope_id`,`path`);
(2449, 'default', 0, 'amasty_elastic/catalog/query_settings', '{\"name\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"sku\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qapplication\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qmatname\":{\"spelling\":\"1\",\"combining\":\"1\",\"wildcard\":\"0\"},\"gtin\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qaddinfo\":{\"spelling\":\"1\",\"combining\":\"1\",\"wildcard\":\"0\"},\"qfeatures\":{\"spelling\":\"1\",\"combining\":\"1\",\"wildcard\":\"0\"},\"qcolor\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qimprint\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qmanufacturername\":{\"spelling\":\"1\",\"combining\":\"1\",\"wildcard\":\"0\"},\"qmodell\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qoverlay_image\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qprodname\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"zshortname\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qgroupcolor\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qprinterseries\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qrawmaterial\":{\"spelling\":\"1\",\"combining\":\"1\",\"wildcard\":\"0\"},\"zprevious_skus\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"qforcompatibility\":{\"wildcard\":\"1\",\"combining\":\"1\",\"spelling\":\"0\"},\"url_key\":{\"combining\":\"0\",\"spelling\":\"0\",\"wildcard\":\"0\"}}'),
(3083, 'default', 0, 'amasty_elastic/catalog/query_settings', '{\n \"sku\": {\n \"wildcard\": \"0\",\n \"spelling\": \"0\",\n \"combining\": \"0\"\n },\n \"name\": {\n \"wildcard\": \"1\",\n \"spelling\": \"0\",\n \"combining\": \"0\"\n },\n \"short_description\": {\n \"wildcard\": \"0\",\n \"spelling\": \"1\",\n \"combining\": \"1\"\n },\n \"description\": {\n \"wildcard\": \"0\",\n \"spelling\": \"1\",\n \"combining\": \"1\"\n }\n}\n'),
ERROR 1452 (23000) at line 9009068: Cannot add or update a child row: a foreign key constraint fails (`labelident2`.`#sql-2fff_3c`, CONSTRAINT `CUSTOMER_EAV_ATTRIBUTE_ATTRIBUTE_ID_EAV_ATTRIBUTE_ATTRIBUTE_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CAS)
ALTER TABLE `customer_eav_attribute`
ADD CONSTRAINT `CUSTOMER_EAV_ATTRIBUTE_ATTRIBUTE_ID_EAV_ATTRIBUTE_ATTRIBUTE_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE;
Answer the question
In order to leave comments, you need to log in
Do you have a unique key that was unique in the old database, suddenly turns out to be repeated in the new one?
This should not happen if the tables are the same.
Compare - either the fields of the table have a different comparison (in particular, the suffix ci - case independent), or the new one has a shorter field length and it is truncated, losing information.
You should not bypass such errors: they are like canaries - they are the first to show that something is wrong with you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question