Title: SQL duplicate entry error after migrating multisite
Last modified: July 27, 2018

---

# SQL duplicate entry error after migrating multisite

 *  [Carmdq](https://wordpress.org/support/users/carmdq/)
 * (@carmdq)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/sql-duplicate-entry-error-after-migrating-multisite/)
 * Hi,
 * I just duplicated two different WP multisites, in order to create staging environments
   in two subdomains. So, I basically created the subdomains, uploaded the backup
   files, created new databases, imported the tables from the backup and modified
   wp-config accordingly. I also searched and replaced old instances of the url 
   with the new subdomain using the following:
 * UPDATE `wp_3_posts` SET `guid` = replace(guid, ‘oldurl’, ‘newurl’);
 * First time worked like a charm. Second time however, I’m getting an error while
   trying to update the url on wp_4_posts. The SQL error I get is: #1062 – Duplicate
   entry ‘msls_1357’ for key ‘option_name’.
 * I suspect msls could be related to the use of the Multisite Language Switcher
   plugin, but I don’t know how to find and fix this entry.
 * Any thoughts?

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/sql-duplicate-entry-error-after-migrating-multisite/#post-10536720)
 * Duplicate entry errors (error #1062) would be unrelated to updating a posts table
   guid field. The option_name key field occurs in the options table, not posts.
   As an index field, it cannot have duplicate entries, the msls_1357 value already
   exists.
 * How are you executing your update query? It appears some other queries are being
   run at the same time.
 * The other strange thing is updating the guid field shouldn’t be necessary, it’s
   supposed to be only a unique global identifier. As long as the value is unique,
   that’s all that is required, it doesn’t even need to be an URL, it could be a
   hash value for all it matters. An URL is just a convenient value that is known
   to be unique. The URL used by WP for the related post should be derived from 
   other means besides the GUID. If altering the guid works on your site, something
   is abusing the intent of this field. Just sayin’. This is not what you asked 
   about, I suppose if it works, don’t fix it.

Viewing 1 replies (of 1 total)

The topic ‘SQL duplicate entry error after migrating multisite’ is closed to new
replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [duplicate](https://wordpress.org/support/topic-tag/duplicate/)
 * [entry](https://wordpress.org/support/topic-tag/entry/)
 * [multisite](https://wordpress.org/support/topic-tag/multisite/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/sql-duplicate-entry-error-after-migrating-multisite/#post-10536720)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
