Well you're here now, you might as well introduce yourself. Oh, me first? So I'm @irms and this is my blog. I care about things like entrepreneurship and how Pepsi tastes better out of a glass bottle. (read more)
September 1st, 2009
I wrote this because I often need to move data-driven sites from development to production and addresses change. (Wordpress sites, Wordpress MU, Drupal, and so on.) This means I have to go through and change every occurrence of the url as it appears in the database. So when the first few solutions for changing the site url aren’t doing the trick, I have to resort to the following MySQL snippet for updating every single table.
To find a string in a certain field and replace it with another string:
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
Well, I got tired of doing that and wrote a handy snippet to find and replace across an entire database.
There are no checks or safeguards! This is a quick and dirty script to be used at your own risk!
But if it’s useful, please feel free to say so in the comments.
Added two checkboxes: