Title: Search &amp; replace in Database
Last modified: August 19, 2016

---

# Search & replace in Database

 *  Resolved [searchen](https://wordpress.org/support/users/searchen/)
 * (@searchen)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/)
 * Hi!
 * I need to remove a subfolder in the “guid” field in my database:
 * The old domain is: “[http://www.nanmelville.com/nm&#8221](http://www.nanmelville.com/nm&#8221);
   
   and what I need is: “”[http://www.nanmelville.com&#8221](http://www.nanmelville.com&#8221);.
 * Using this article in the Codex:
    [http://codex.wordpress.org/Changing_The_Site_URL#Domain_Name_Change](http://codex.wordpress.org/Changing_The_Site_URL#Domain_Name_Change),
   I entered the following:
 *     ```
       UPDATE wp_nm_posts SET guid = REPLACE (
       guid,
       'http://www.nanmelville.com/nm/',
       'http://www.nanmelville.com/’);
       ```
   
 * but am getting an error code from phpMyAdmin:
 * `#1064 - You have an error in your SQL syntax; check the manual that corresponds
   to your MySQL server version for the right syntax to use near ''http://www.nanmelville.
   com/â€™)' at line 4`
 * What am I doing wrong?
 * Thanks
    peter

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [jon](https://wordpress.org/support/users/adiant/)
 * (@adiant)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680483)
 * I don’t know what’s wrong. But I strongly suggest using the Search and Replace
   plug-in. It allows you to select just the GUID column, just as you wish to.
 * [http://wordpress.org/extend/plugins/search-and-replace/screenshots/](http://wordpress.org/extend/plugins/search-and-replace/screenshots/)
 *  Thread Starter [searchen](https://wordpress.org/support/users/searchen/)
 * (@searchen)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680486)
 * Will this work if my post database is not vanilla “wp_posts” but is “wp-nm_posts”
 * If so, then it should be great!
 * Thanks for replying
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680487)
 * The plugin should pull your table prefix from the `wp-config.php` file. At least
   it did the last time I used it. 🙂
 *  [jon](https://wordpress.org/support/users/adiant/)
 * (@adiant)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680491)
 * The first screenshot on the link I listed above confirms that the plug-in is 
   smart enough to find the _posts table as it lists “_posts” without a prefix.
 *  Thread Starter [searchen](https://wordpress.org/support/users/searchen/)
 * (@searchen)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680492)
 * It works… that’s brilliant!
 * Many thanks.
 * Trauma over!
 *  Thread Starter [searchen](https://wordpress.org/support/users/searchen/)
 * (@searchen)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680605)
 * [@adiant](https://wordpress.org/support/users/adiant/)
    [@james](https://wordpress.org/support/users/james/)
   Thank you both so much! Great support!
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680607)
 * You’re welcome!
 *  [jon](https://wordpress.org/support/users/adiant/)
 * (@adiant)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680631)
 * Likewise!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Search & replace in Database’ is closed to new replies.

## Tags

 * [MySQL database](https://wordpress.org/support/topic-tag/mysql-database/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [jon](https://wordpress.org/support/users/adiant/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/search-replace-in-database/#post-1680631)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
