1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[ASK] Find and replace for WP Blog DB?

Discussion in 'Blogging' started by makingfastcash22, Mar 10, 2011.

  1. makingfastcash22

    makingfastcash22 Senior Member

    Joined:
    Feb 15, 2009
    Messages:
    1,152
    Likes Received:
    178
    Home Page:
    I am creating autoblogs to sell and I am setting them up on a test domain.

    How can I go in later to find and replace all references to my test domain and input the new owners domain?

    Also I will be needing to do the same thing for affiliate ids. Finding mine and replacing theirs.

    I searched using the search option in myphp and I can find most references, but I tried to manually replace them one by one and its killing me.

    There has to be a faster,easier way!

    :)
     
  2. ulijonroth

    ulijonroth Regular Member

    Joined:
    May 6, 2010
    Messages:
    205
    Likes Received:
    769
    Occupation:
    If you work for a living, why do you kill yourself
    Location:
    localhost
    Simply get the SQL file open with Notepad++ and hit Search & Replace...
     
  3. Marketing Jhonny

    Marketing Jhonny Registered Member

    Joined:
    Dec 10, 2010
    Messages:
    87
    Likes Received:
    27
    Occupation:
    Im an SEO Specialist
    Location:
    506 | 1337 Marketing!
    Or use PHPmyAdmin ;)
     
  4. makingfastcash22

    makingfastcash22 Senior Member

    Joined:
    Feb 15, 2009
    Messages:
    1,152
    Likes Received:
    178
    Home Page:
    I did that in notepad... still sucked...

    So tell me more about an easy way to do it in phpmyadmin ? :)
     
  5. ulijonroth

    ulijonroth Regular Member

    Joined:
    May 6, 2010
    Messages:
    205
    Likes Received:
    769
    Occupation:
    If you work for a living, why do you kill yourself
    Location:
    localhost
    Not Notepad.

    The software name is Notepad++
    Check it on their site.

    Code:
    http://notepad-plus-plus.org/
     
  6. makingfastcash22

    makingfastcash22 Senior Member

    Joined:
    Feb 15, 2009
    Messages:
    1,152
    Likes Received:
    178
    Home Page:
    Thanks Guys for the tips!

    I also found this way to do it without having to export the database.

    I am posting it here, in case anyone else needs to do it this way.

    Using SQL Query Search and Replace
    1. Login to phpMyAdmin and select your database
    2. Click the SQL tab
    3. Enter the following in the run SQL Query text box (replacing tablename, tablefield, findstring and replacestring with your actual information:
      UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");
    4. Click go to process the changes and update your SQL database
    That's all there is to it. A quick and effective way to replace multiple text string SQL database content on the fly from phpMyAdmin.
    Here is a WordPress SQL Query database example for reference:
    UPDATE wp_posts SET post_content = replace(post_content,"Yahoo.c0m","Bing.c0m")
    This example would replace any and all occurrences of yahoo.c0m with bing.c0m in the post_content field under table wp_posts
     
  7. Santini

    Santini Junior Member

    Joined:
    Mar 10, 2011
    Messages:
    123
    Likes Received:
    17
    Location:
    London, England
    Nice solution, I'll add that to my "useful SQL queries" document.
     
  8. roberteb

    roberteb Regular Member

    Joined:
    Oct 30, 2010
    Messages:
    402
    Likes Received:
    120
    Location:
    UK
    Or just use Backupbuddy to clone the site. Quick and easy :)
     
  9. makingfastcash22

    makingfastcash22 Senior Member

    Joined:
    Feb 15, 2009
    Messages:
    1,152
    Likes Received:
    178
    Home Page:
    If you clone the site, wouldn't it still have the test site domain in the database?

    Or does backup buddy have a feature to change that easily?