skip to Main Content

Trying to export WordPress production DB from Godaddy and import in local MAMP and I am getting this error.

enter image description here

2

Answers


  1. In this case I would suggest to first change the character encoding from the current location (phpMyAdmin) that the site is running, once you have successfully changed the encoding you can repair the table that is been triggered with the duplication.

    By repairing the table you should be able to afterwards not run into such issues. Also from the looks of it thats the Wordfence back logs which you can drop if you still encounter a duplicate error (which I doubt that you will run once you have repaired the table after the proper character encoding has been set).

    Login or Signup to reply.
  2. This is usually due to a mismatch of the character encoding that the database is being exported from and the default encoding of the new database.

    To check this, export a fresh db from Godaddy and search for this line:

    `meta_key` varchar(255) COLLATE
    

    Right after COLLATE you should see the encoding string, e.g:

    `meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
    

    So for me, I need to make sure I am importing the database into a new database that supports utf8mb4_unicode_ci, but the error you are getting is more common with utf8mb4_unicode_520_ci as if your MAMP is out of date it might not support that yet.

    Solution 1

    Create a new Database an set the coallition to match the one you found in your sql file. The coalition setting is right next to where you type the table name:

    enter image description here

    Solution 2

    If the Coalition you need doesn’t exist, update MAMP to the latest build and that will have all the latest coalitions and will successfully import for you if you select the matching coalition when creating a new Database.

    Solution 3

    Find and replace utf8mb4_unicode_ci (or whatever your encoding type is) and replace it with utf8_unicode_ci. Now import the sql file.

    This one is a bit hackey, but it will allow you to import the file, but depending on what you encoding used to be, you might get random symbols not printing out right and will need replaced.

    Sidenote:
    This could be a Wordfence issue, it has tons of tables that hold a lot of content. I highly reccommend removing it before you export, but make sure you tick the option “Delete Wordfence tables and data on deactivation”.

    This setting is available in Wordfence -> All Options -> General Wordfence Options

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search