'#1062 - Duplicate entry '_site_transient_timeout_theme_roots' for key 'option_name'

I'm migrating a site from Site5 hosting to InMotion Hosting and the importation of the mysql file (via phpMyAdmin) is not working.

import of mysql file failed, returning this error msg:

#1062 - Duplicate entry '_site_transient_timeout_theme_roots' for key 'option_name'

From what I've been able to garner on various forums with my pleas for assistance is this: every table has a key?

so I guess I should hunt for some type of duplicate in the option_name table?

Am lost Please help



Solution 1:[1]

I have seen this type of problem many times.

My employer's company has a DB Hosting client that uses Drupal.

There is a particular table called search_index that holds words.

The character set being used for the table differs from the character set being used to record the data from an incoming Web Browser session. When I mysqldump this database and reload it into another MySQL Instance, I was getting error 1062 also. I was screaming "How in the world would a mysqldump fail on a reload ?"

Since the table's data was being collected on an on-going basis, the client gave me permission to truncate the table, then mysqldump the database. Needlessly to say, the reload of the mysqldump was successful.

Given the error message, the only way this could be happening to you is if the _site_transient_timeout_theme_roots table has an indexed column called option_name and that column's character data is incompatible with the table's character set. For example, the table may have been created with UTF-8 and you are loading Latin-1 characters or some freakish Unicode into option_name. You won't have any issue with the data being stored. It's when you mysqldump the table and reload that the character set weirdness rears its ugly head.

Solution 2:[2]

Make sure you exported only the database you want to import and not more than 1 database.

I got this error when I accidentally exported the DB server, not the DB, then tried to import multiple DBes.

Solution 3:[3]

If you have Caching plugings such as Autoptimize and WP Fastest Cache and others alike, make sure you clear all caches BEFORE you export the database.

Solution 4:[4]

If anybody see this post, the solution is align all charset and collation types between the file (when save the file set the charset or open with textpad and change the charset) and the database then put this line at the beginning of the file :

SET NAMES utf8mb4;

worked fine for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RolandoMySQLDBA
Solution 2 GoodyNH
Solution 3 aimass
Solution 4 Gnqz