PhpMyAdmin SQL Search and Replace

In the following simple solution, I'll show you how to Search and Replace SQL database information from PhpMyAdmin. This SQL query method is extremely helpful when you need to replace multiple text strings and do not wish to export the entire database just to make those changes. With the SQL Search and Replace (SQL Query Method) the database changes can be made instantly on the fly.

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,"coolstuff.com","lancelhoff.com")

This example would replace any and all occurrences of coolstuff.com with lancelhoff.com in the post_content field under table wp_posts