[ASK] Find and replace for WP Blog DB?

makingfastcash22

Senior Member
Joined
Feb 15, 2009
Messages
1,159
Reaction score
180
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!

:)
 
Simply get the SQL file open with Notepad++ and hit Search & Replace...
 
I did that in notepad... still sucked...

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

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

Code:
http://notepad-plus-plus.org/
 
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
 
Using SQL Query Search and Replace
Login to phpMyAdmin and select your database
Click the SQL tab
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");
Click go to process the changes and update your SQL database

Nice solution, I'll add that to my "useful SQL queries" document.
 
Or just use Backupbuddy to clone the site. Quick and easy :)
 
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?
 
Back
Top