Find and Replace Data in all Columns and Tables in MySQL

Here is a quick way to find and replace data in a Mysql database across all columns and tables at once. I use this method when I am launching a new wordpress site taking it from dev platform over to production (i would just search and replace the wordpress localhost name with the wordpress production hostname)

Usually to do cross table search and replace requires some complex sql queries which opens you up to the possibility of errors.

This way is much faster.

  1. Backup your database.
  2. Do a sql dump of the structure and data into one single sql file or text file
  3. Open the file in notepad or text editor
  4. Use the search and replace function from the text editor
  5. Import the text file back into your database.

Done.