Mass Replace String use MySQL REPLACE function

Since i changed the path for a friend’s blog, i need update the files and images path URL in all previous posts.
The best way i found is use MySQL REPLACE function to replace string in hundreds of records. Only need 1 minute.

Here is the SQL query to replace string in database table:

UPDATE table_name SET column_name = REPLACE(column_name,”original_string”,”replace_string”)

SQL query for mass replace string in wordpress table

UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`, '', '')
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`, '', '')
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Mass Replace String use MySQL REPLACE function”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>