How to Perform a Database Find & Replace in phpMyAdmin

When moving a WordPress website from one domain to another, making structural changes, or simply mass modifying one piece of data or another on your site, making changes to the contents of your database usually means downloading an SQL backup, editing it manually, and then importing the updated SQL back to the database – a time waster, and risky, to boot.

Using a simple string to find and replace within the database automatically via phpMyAdmin is much faster and safer, and does not require any advanced knowledge of SQL. Simply follow these instructions and have it done in seconds:

NOTE: As is always the case when working with a valuable database, be sure to back up before you get started! Even the best minds make mistakes sometimes, and a backup ensures that you’ll not lose anything more than the few minutes it takes to restore the database if something goes wrong.

  1. Login to PHPmyAdmin via cPanel
  2. Select the database you want in the left frame (refer to your websites wp-config.php if you need a reminder of the database name)
  3. Click the “SQL” tab in the top frame
  4. Add the following code (after modifying – see below) and update by clicking “GO”:

UPDATE `tablename` SET fieldname = replace(fieldname,”searchstring”,”replacestring”)


Replace “tablename” with the name of the table that you want to work within, “fieldname” with the title of the table field that you want to search, “searchstring” with the text that you want to find within that field, and “replacestring” with the text that you want to replace that found data.

This method of finding and replacing within an SQL database is highly useful, allowing you to make huge changes to your content, mass-correct typos, or even modify one keywork into another for the sake of search engines – use it wisely, and carefully!

Share Your Thoughts