Search and Replace MySQL (phpMyAdmin)

// MySQL

What it does

This SQL script will find and replace the oldtext with the newtext in your database. This is often required when changing domains, or moving from development to production environments.

In the example below:

  • wp_posts = table name
  • post_content = column
  • oldtext = string to replace
  • newtext = new string to be set

The Code

UPDATE `wp_posts` SET `post_content` = REPLACE ( `post_content`, 'oldtext', 'newtext' );

How To Use It

Run this script in the SQL tab of phpMyAdmin.