Find and replace in MySQL

Discussion in 'Server Management' started by MultiBam, Feb 9, 2014.

  1. MultiBam

    MultiBam Administrator Staff Member

    Syntax:
    Code:
    update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
    Wordpress example:
    Code:
    UPDATE wp_posts SET post_content = REPLACE(post_content,'http://www.oldurl.com','http://www.newurl.com');
    vBulletin example
    Code:
    UPDATE post SET pagetext = REPLACE(pagetext,'http://rg.to','http://rapidgator.net');
     
    Last edited: Feb 10, 2014

Share This Page