I am trying to import a MySQL database into the localhost database that was exported from the remote database and I am receiving a #1062 error (which is weirdly in French!):
#1062 - Duplicata du champ '1' pour la clef 'PRIMARY'
Google translate: # 1062 - Duplicate field '1' for key 'PRIMARY'
The code that it highlights is as follows:
--
-- Dumping data for table `exp_accessories`
--
INSERT INTO `exp_accessories` (`accessory_id`, `class`, `member_groups`, `controllers`, `accessory_version`) VALUES
(1, 'Expressionengine_info_acc', '1|5', 'content|members|admin_content|design|tools_communicate|homepage|addons_fieldtypes|content_files|admin_system|tools_data|addons|tools|tools_logs|tools_utilities|addons_accessories|content_files_modal|myaccount|addons_modules|addons_plugins|content_publish|content_edit|addons_extensions', '1.0'),
(2, 'Cartthrob_acc', '1|5', 'content|members|admin_content|design|tools_communicate|homepage|addons_fieldtypes|content_files|admin_system|tools_data|addons|tools|tools_logs|tools_utilities|addons_accessories|content_files_modal|myaccount|addons_modules|addons_plugins|content_publish|content_edit|addons_extensions', '1.0');
I am a novice with SQL and I can't see what it is on about. I can't see a duplicate in the primary key, the accessory_ids appear to be 1 and 2? Am I missing something here? And why is there a duplicate here and not on the remote server?
Many thanks
Gabe
Best Answer
Your local table is likely not empty, thus the error when conflicting with existent data. If you do not want to keep any of the current data, you need to delete all rows before the insert. One fast way to do that is with:
Usually,
mysqldump
will drop the table before import, like this:Regarding French, client sessions can change the default
language
setting by doingSET lc_messages = 'en_US';
and receive error messages in a different language.