MySQL Find and Replace

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

One of the most common things that needs to be done when tidying up a database is to bulk find and replace data in MySQL tables. This can be for things like spelling mistakes, changing categories of products or any other value held in a MySQL database table.

Its an easy thing to do though and here is the code:

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');

note - nice syntax highlighting plugin used is mentioned here