stirling web design and development

Find And Replace A String In MySQL

Nice bit of SQL that i use quite a bit to update wordpress domain names

I’m finding this little snippet of code extremely useful at the minute. A simple way to change a string in a MySQL database.

UPDATE table SET field = REPLACE(field,'oldString','newString');

I’ve been using this a lot lately when migrating WordPress installations from host to host and i have to change the url from say http://mydomain.com to http://anotherdomain.co.uk.