alyasabrina alyasabrina - 1 year ago 123
SQL Question

Find and Replace text in all table using mysql query

Usually I use manual find to replace text in mysql database using phpmyadmin, and im tired now, how to run query find and replace that search all table and replace with new text in phpmyadmin.

example : find keyword domain.com, replace with www.domain.com

Thanks..

Answer Source

For a single table update

 UPDATE `table_name`
 SET `field_name` = replace(same_field_name, 'unwanted_text', 'wanted_text')

From multiple tables-

If you want to edit from all tables, best way is to take the dump and then find/replace and upload it back.