Often your MySQL database is so large that if you want to find and replace a given entry, it will take days. This is when this simple snippet comes handy:

UPDATE [your_table_name] SET [your_table_field] = REPLACE([your_table_field], '[string_to_find]' , '[string_to_be_replaced]');

It will do a simple search and replace (just like Microsoft Word’s integrated function) on all the entries inside the specified table and field. Note that if your database has a lot of entries (e.g. millions), the pricess may take a few minutes or even time out.

Leave a Reply

Your email address will not be published. Required fields are marked *