The syntax for batch replacement of the string bitsCN.com in the specified MySQL field is as follows:
UPDATE table name SET
Specify field = replace (specify the field, 'replacement string', 'desired string ')
WHERE condition;
If you want to replace "solve" with "free" in the content field of the record whose ID is less than 5000 in the article table, the syntax is:
UPDATE article SET
Content = replace (content, 'Resolution', 'release ')
Where id <5000;
Is it convenient :)
There are many download connections on the website. Previously Port 86 was used. now the server is migrated. the default port 80 for the new server is used. there is no way to change the Apache listening port for one site, so we can only change the site.
Fortunately, all links are written in the MySQL database, so it is very efficient to replace the port number in the specified field in batches through MySQL.
The syntax for batch replacement of a specific string of a specified field in MySQL is as follows:
UPDATE table name SET
Specify field = replace (specify the field, 'string to be replaced ', 'string to be replaced ')
WHERE condition;
In addition, the IDs can be filtered and replaced. for example, if we want to replace "86" with "80" in the field_down_value field with the ID less than 300 in the content_type _ theme table, the syntax is:
UPDATE content_type _ theme SET
Field_down_value = replace (field_down_value, '86', '80 ′);
Where id <300;
BitsCN.com