mysql query string replacement statement summary of database string replacement

  • 2020-05-12 06:22:52
  • OfStack

Replace 10005 in the ubk_vhost_list table with 10010 in the userid field

UPDATE `table_name` SET `field_name` = replace (`field_name`,'from_str','to_str') WHERE `field_name` LIKE '%from_str%'

table_name -- the name of the table
field_name -- field name
from_str -- the string that needs to be replaced
to_str -- the replaced string

A query was run today
UPDATE ubk_vhost_list SET userid = replace (userid,'10005','10010')

A more detailed mysql string replacement statement can be found in the following article

Related articles: