How to Use PHPMyAdmin Find and Replace in Your Database

How to do PHPMyAdmin Find and Replace?

Find and replace is an awesome concept. I use find & replace every day in different forms – documents, my text-editor, etc. but one that I use all the time is to run a find & replace query in the PHPMyAdmin of MySQL databases.

I use this regularly to clean up WordPress databases that I’ve migrated to my hosting service. You see, WordPress stores virtually everything in a database and, unless you enjoy going table by table, field by field, searching for that one instance of a domain name that you need to change, then you will want to keep this tool handy.

It’s really simple: In the query field on the SQL tab of PHPMyAdmin run this:

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');

Here is what it means for WordPress users:

  • [table_name] – This is the name of the table that you’re wanting to update and along with…
  • [field_name] – This first instance of the field name tells MySQL where to make the update and where you’re looking for that bit of info to reside
  • [field_name] – This is the second instance of the field name, where you’re telling the function to find it, and this is the place that you want to make the change
  • [string to find] – This is the specific text that you are looking to remove
  • [string to replace] – This is what you want to add in its place

Just make sure that you remove the brackets, those are there to make it a little easier to read and understand. See, it’s not so bad!

Here is what an example would look like

In this example I’m looking to replace all instances of the word “capital” a financial term, with “capitol” a term related to a place where a legislative body meets. I want this change to be made in the body content on all posts and pages so the table_name will be wp_posts and the field name would be post_content.

My statement would look like this:

update wp_posts set post_content = replace(post_content, 'capital','capitol');

All you have to do is hit “go” and PHPMyAdmin will take care of the rest.

A couple things to keep in mind:

  • There is no “undo”. Make sure your statement is accurate. Otherwise, you’ll be doing a find and replace for the mistake you just made.
  • Tread carefully. This is your database, and it assumes, that if you’re in here you have at least some sort of idea as to what you’re doing.
  • Changes are immediate. No waiting for caches to refresh (unless you’re using some sort of caching system). Your changes should be immediately visible.

I hope that helps! I use find and replace all the time and having this tool available to you will make your edits and changes much easier.

See Also:

What Type of Blogs Make the Most Money?


"What type of blogs make the most money? Starting a blog is one of the first things that people think about when they start thinking about trying to make money online. But for most beginners they don’t know what type of blogs make the most money, so they get stuck and end up wasting a […]"

Keep Reading...

What kind of website do you want to build?


"So, now that we have that covered, let’s talk about how the type of website you want to build factors in to the cost. To dig a little deeper in to the previous point about complexity, I’m going to walk you through a few different types of websites and what to be on the lookout […]"

Keep Reading...

Can I start a blog for free?


"You can totally start a blog for free. All you need to start a blog for free is a little inspiration, a lot of perspiration and to sign up for one of the numerous free websites that will allow you to start a blog for free. You can check this post here for several options […]"

Keep Reading...

How to promote your blog content


"Promoting the content you create is a crucial step that many overlook when you start a blog. Think about it this way: You’ve probably heard the old adage, “If a tree falls in a forest and no one is around to hear it, does it make a sound?” Similarly, if you create an epic post on […]"

Keep Reading...

What kind of blog should I start?


"There are two main things that you want to consider when thinking about what you need to do to start a blog and what kind of blog you should start: What medium you want to use When you’re thinking about the “kind” of blog you want to start it means that you can start a […]"

Keep Reading...

Buying Premium Domains


"Sometimes the domain name you choose is already registered, as mentioned previously. However, don’t let that stop you. Buying your domain name from someone else is a great way to get that perfect domain you’re searching for, but wasn’t available for registration on Godaddy. Premium domains are those that show up with those big price […]"

Keep Reading...

How To Design The Best Homepage Ever That Converts Like Crazy (with examples)


"Step by step I walk you through the 7 critical factors to build the best possible homepage for your website that will convert like crazy! If you’ve ever wondered what the secret formula is for a killer homepage you’re in luck because that’s exactly what I’m covering here. Too often, people just dump stuff on […]"

Keep Reading...

How To Start A Blog Successfully in 2021


"This post is the complete step by step guide on everything you need to know on how to start a blog. Doesn’t matter if you’re brand new to the idea of blogging, or you’re looking to get deeper insight on some of the finer details, everything you need to know to start a blog is […]"

Keep Reading...

Can I pay for ClickFunnels with PayPal?


"Unfortunately, as of February 2021, PayPal is not among the available payment options when you’re trying to sign up with PayPal. But there’s an exception! If you use a PayPal MasterCard debit card when you sign up, you can use your PayPal account that way. So while there isn’t a direct integration to PayPal on […]"

Keep Reading...

Homepage Web Design: How Do You Design a Good Homepage?


"How do you design a good homepage? In order to create the best homepage you can, you have to understand that it’s a little bit “art” and and a little bit “science.” To create the best homepage web design you first have to define your priorities and align them with your target audience. You have […]"

Keep Reading...

One thought on “How to Use PHPMyAdmin Find and Replace in Your Database

Join The

Leave a Reply

Your email address will not be published.

Name (required)