MySQL – How to replace strings in multiple records

I get this asked quite often, so here is a simple example of using MySQL command for replacing one string with another in multiple rows:

This command will replace a word ‘one’ with ‘two’:

UPDATE table SET columnname = REPLACE (columnname, 'one', 'two') WHERE columnname LIKE '%one%'

Facebook Comments