How do you find and replace URL in MySQL?
How do you find and replace text in WordPress database?
I encountered this problem yesterday and it was annoying. I moved to a new web host from a managed WordPress hosting to Cloudways. The problem was all fine until I noticed that half of my site links are broken. Previously, the links were working because I did a redirect but after moving to a new web host, that method doesn't work anymore.
I scrambled to figure out a way to find and replace URL in MySQL but I have zero idea how to get that work. I came across this article by Interconnect/it about a script that can find and replace text in WordPress database. I'm not sure what I did but it doesn't work.
Important note: If you are planning to use the script to change the WordPress database, make sure you did a full backup!
I was literally back at square one I want to get the 404 errors fixed as soon as possible to optimize my WordPress site for SEO. Sh*tty stuffs, honestly.
Thankfully, I met up with Muneeb from Cloudways and he recommended me to search for WordPress change URL plugin.
The light bulb moment strike!
There are over a dozen of plugins that offers find and replace texts in WordPress database.
I decided to go with Search & Replace by inpsyde GmbH because it has over 100,000 active installations as a safe bet.
Here are the steps I took to install the plugin.
Start by searching for the plugin on your WordPress dashboard. You should search for "Search & Replace" for faster and accurate search results. Locate the plugin and click on the "Install Now" button.
Once you have install the plugin, it is time to activate it.
The next step involves searching for the plugin and head over to the settings.
You will see this screen and I highly recommend you to do a full backup by clicking on the "Create SQL File" button as seen below.
Important: Please backup your WordPress site before find and replace URL in MySQL database!
The next two steps are critical. Messing these up will crash your site. Start with filling up the "search for"and "replace with" columns.
The last step involves searching the relevant tables. I suggest you go with "Select All Tables" for the best results. You should select "Save changes to Database" instead of "Export SQL file with changes."
Selecting the export option will not find and replace text in your WordPress database. Complete the find and replace URL by hitting on the blue button.
The whole process will take around 5 to 30 minutes depending on the size of your WordPress database.
By using a find and replace URL plugin, you don't have to get your hands dirty by doing the tedious database search and replace script in php.
This plugin allows you to change quite a lot of things in your WordPres database including:
With this simple and free plugin, you no longer need to hire web developer to find and replace text in your WordPress database!
I hope you find this tutorial useful and you will be able to find and replace URLs on your WordPress database easily. Leave a comment below and tell me what you think!