Mysql – Replace String within Serialized data

MySQL

I am moving my forum from one domain to another and need to replace all instances of the previous domain with the new one. In looking at the mysql data, many of the matches are going to be in the middle of a serialized string, is there a quick way to replace all matches?

Best Answer

You're probably not still looking for an answer, but in case anyone else stumbles across this question.

This is an issue in WordPress development all the time. There's a tool built specifically for it by Interconnectit - https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

I've never tried it for anything other than WordPress, but it connects directly to the database using the standard user/pw info, so you should be able to connect it to any database. I think the only thing WordPress specfic is it auto-populates the database info.

It's quick and easy to use, and it deals with serialized strings so they don't become a hassle.