Alternatively the string implementation mysql:
mysql replace the function directly replace mysql database in a field of a specific string, no longer need to write a function to replace, very convenient to use. mysql replacement function replace ()
UPDATE `table_name` SET `field_name` = replace (`field_name`,'from_str','to_str') WHERE `field_name` LIKE '%from_str%'
Description:
The name of the table - table_name
field_name - field name
from_str - string needs to be replaced
to_str - replace string
E.g:
mysql> SELECT REPLACE('www.lvtao.net', 'www', 'http://www');
-> 'https://www.lvtao.net'
This function is multi-byte safe , which means you do not have to consider is Chinese characters or English characters.