May
May

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:

How to choose a domain name

Jun

"My bet is that once you figured out that you wanted to start a blog and you knew what you want to blog about the first thing that happened was that domain names started running through your head. And what you choose for your custom domain name can be different if you’re starting a personal […]"

Keep Reading...

Who is ClickFunnels for?

Jan

"You might be wondering: Should I use ClickFunnels? The short answer is yes. ClickFunnels as a marketing tool can be used by any kind of online business. It’s easy for beginners to use because there are a variety of tools that make it easy to build out your own sales funnels by yourself without need […]"

Keep Reading...

How to Generate Leads For Realtors in 2021

Apr

"How to generate leads for realtors The real estate market is absolutely on fire in 2021! So, as a realtor, how do you tap into this market? And an even better question is, how are you going to make sure your sales funnel stays funnel if and when things cool off? Having a constant source […]"

Keep Reading...

Website Copywriting Template: The Pages You Need & How to Write Them

Apr

"Website Copywriting Template What does success look like for your website and its content? If you don’t know what you’re creating, how can you see if it’s successful or not? When it comes to building out a website I’ve found that creating the content for the new site is among the biggest challenges customers and […]"

Keep Reading...

Can Digital Marketing Save Your Business?

Feb

"Can digital marketing save your business? It’s a fair question and one worth answering. After all, the global pandemic has everyone trying to figure out ways to keep their businesses afloat during the hardest economic times in decades. Let’s get right to the point: can digital marketing save your business? Absolutely, here’s why. Digital marketing […]"

Keep Reading...

Is ClickFunnels Safe? Read this First!

Jan

"Is ClickFunnels safe? ClickFunnels is making a lot of noise these days in the online business world and for good reason. Thousands of businesses of all kinds are using it to power their online business, and in the process, bringing in millions in revenue. And one of the things that’s made ClickFunnels so popular is […]"

Keep Reading...

How to optimize your blog content for SEO

Jun

"When you start a blog SEO is one of the first things that comes into mind. SEO though is a long term game. There are more important things to worry about when you’re starting a new blog than SEO. But… … that doesn’t mean you should ignore it. STEP 5: Optimize your new blog for […]"

Keep Reading...

How To Generate Leads For Interior Design in 2021

Jan

"How can you generate leads for your interior design business? Lead generation is the life-blood of any sustainable business. And having a solid, reliable, and proven plan is essential to the process. So if you’re looking for the answer to the question “how to generate leads for interior design”, then you’re in the right place. […]"

Keep Reading...

12 Steps to take to help make your WordPress site more secure

Apr

"Imagine this: You’re up early because you’re excited about finally cranking out that project on your website that you’ve been so excited about. You’ve got your coffee brewed and the aroma is filling the room; you’re super excited and ready to go. You sit down at your computer, ready to get to work and open […]"

Keep Reading...

6 Common Website Image Problems – Which Ones Do You Need To Overcome?

Apr

"What if I told you that the images you’re using on your website are killing your results? What if I told you that you are losing business, leaking conversion opportunities, and turning off your ideal customers with the images you’re using on your site? Would that get your attention? I bet it would. Because I […]"

Keep Reading...