0

How to find and replace text in mysql table

In this post i will explain an extremely basic MySql Problem of Replacing a Text in mysql Table.Suppose You have a table name posts with title and description. There are some normal content or links you have included in your all posts like old site connection but now you want to update old links with new ones.But you don’t wanna do this manually one by one because you know very well that it will take months.So Now Lets be smart and use mysql query to find and replace all the links at onces.It will take less then a second.

find and replace sql query, mysql find and replace in column, mysql find and replace part of string, mysql find and replace regex, mysql search and replace wordpress, phpmyadmin find and replace url, replace query in mysql, sql find and replace string

TABLE: POSTS

IDTITLEDESCRIPTIONSTATUS
1TITLE-1My first description visit for more info www.growwebsite.com/subscribe1
2TITLE-2My second description visit for more info www.growwebsite.com/subscribe1
3TITLE-3My third description visit for more info www.growwebsite.com/subscribe0

In the above table there is a link (www.growwebsite.com/subscribe) in description column which i have to replace with www.growwebsite.com, For same MySql query will be..

You can also apply conditional query to replace text form only active posts by WHERE clause.

Leave a Reply

Your email address will not be published. Required fields are marked *