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 serviceupdate [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:

Is ClickFunnels good for blogging?


"So, remember the last part about how ClickFunnels is great at building online sales funnels, but not great at others? Well, building a blog on ClickFunnels would not be something I’d do. It’s just not designed to do that. ClickFunnels is not good for blogging or building a blogging platform. If you try to use […]"

Keep Reading...

How To Start A Music Blog In 11 Easy Steps


"Starting a music blog is a great way to capitalize on you passion for music whether you’re a musician yourself, a producer, or just a die-hard fan. Here’s a list of things you want to start a music blog from scratch: Step 1: Choose The Niche You Want To Focus On For Your Music Blog […]"

Keep Reading...

Getting Ideas For Buying Expired Domain Names?


"Getting Ideas For Buying Expired Domain Names? So we’ve covered a lot so far. You’ve got a few ideas, but you need some inspiration. Here are a few sources where you can generate some ideas for your domain name Domain Tools – Find some great suggestions by starting with your idea, or keyword ideas Domainr […]"

Keep Reading...

Is ClickFunnels a scam?


"I understand why this would come up. After all, wherever money is being made, there is no doubt that less-than-ethical people are going to flock and try to get in on it by any means they can. But as a longtime user, I can personally attest that ClickFunnels is most definitely not a scam. If […]"

Keep Reading...

What content should be on a website?


"Struggling to figure out what content you should have on your new website? When it comes to learning how to start a blog, or any other kind of website for that matter, the most important thing you need to know about website content is that each time a visitor lands on your website they’re asking […]"

Keep Reading...

Can I use ClickFunnels For Clients? The Truth Revealed


"“Can I use ClickFunnels for clients?” If you’re a designer or agency, adding ClickFunnels to your service offerings can be a fantastic business move, even if you’re not a tech person and you don’t know anything about code! So can you use ClickFunnels for clients? Absolutely, yes. Web designers, developers, and marketing agencies of all […]"

Keep Reading...

Lead Generation for Contractors: Think Outside The Box


"Lead generation for contractors: how is it done? My friend Dan is a landscaping contractor and the effects of the 2020 quarantine devastated his business. Not only was it hard for him to find new business, even his existing clients were failing to pay their invoices. But despite the crazy circumstances that was 2020 — […]"

Keep Reading...

What’s The Best Way To Generate Leads With No Money?


"What’s the best way to generate leads with no money? Budgetary restrictions are rough. Trust me – I get it. I know when I got started that I didn’t have any budget to do any kind of paid lead generation. So I had to learn how to make things work without any money. And I […]"

Keep Reading...

WordPress Alternatives – 21 Popular Options Other Than WordPress In 2021


"Today there are more choices than ever when it comes to choosing a content management system for your website project. WordPress is a great platform, but it really isn’t the right solution for every project. There may be all kinds of reasons you’d look for an alternative to WordPress: ease-of-use, functionality, technical level, features, and […]"

Keep Reading...

What kinds of websites can I build with ClickFunnels?


"Here’s the deal: ClickFunnels is the best online sales funnel builder on the market today. There isn’t another that comes close. It’s exceedingly good at what it does. But it’s not right for all kinds of websites. It’s great for building some of the kinds of websites we’ve already talked about – websites for contractors, […]"

Keep Reading...