Substring change in MySQL

 

 

When you need a substring change in MySQL Database. It means you need to change part of the content of a field, usually a URL when the website is moved on a different domain.

After you have imported your old tables and content, you may start working on the URL change.

First, remember to have a backup.

Use the Search tool and identify tables and fields where you need the text change.

   

Then go to the SQL tab and write down this function (changing details) and simulate. If you are a brave guy click directly GO.

UPDATE `table_name`
SET `field_name` = replace(same_field_name, ‘unwanted_text’, ‘wanted_text’)

The result should be a green light and all field updated in few seconds.  

Leave a Reply

Your email address will not be published.