Search and Replace Function in MySQL thru MyPhp Admin
Warning if you don’t know how to use MySql Query better make a trial to those database that you will not loose anything if your ruin it.. You have been warned. !!!
If you want to search and update any broken links that you may find using your Google Webmaster Tools, changing it from MySQL will be much easier than looking it at your WordPress Edit Page. So here is the Step by Step Solution from that problem.
- Check the broken links at your Google Webmaster tools
- If you find out the broken links , you must know on where do you want this to be redirected permanently. Since we need to replace those broken link to a live live via Search and Replace function at MySql Php My Admin.
- Edit below syntax , and paste is to the query tab at your MY Sql Dashboard
UPDATE DatabaseName SET post_content = REPLACE(post_content,"String#1","String#2")
The Database Name is the name of your Post Database ( i.e Wpk20_post )
post_content is part of Post database where you want to change the broken string.
String#1 is the broken links or URL
String#2 is the target links or URL
UPDATE Wpk20_post SET post_content = REPLACE(post_content,"https://www.techathand.net/klasjdhasd","https://www.techathand.net")
It will mean that you like to update all links pointing to
https://www.techathand.net/klasjdhasd into https://www.techathand.net, Even if the link shows 100 times, the query will change all the 100 data in database that match the query.
This method is really applicable if you are changing domain name and you don’t want to ruin the linking structure of your blog and return a Error 404 Page.
Well I actually tried to research this one because there are lots of broken links in this blog that was made when I shifted from blogspot to WordPress 2 years ago. Yup it takes me 2 years before I tried to clean up my database.
Ooopss for sure I am not the only one who have this habit 🙂
[…] Read the original: Search and Replace Function in MySQL thru MyPhp Admin […]