I have a WordPress database which was installed in a development environment… thus, all references to the site itself have a fixed IP address (say 192.168.16.2). Now, I have to migrate that database to a new WordPress installation on a hosting. The problem is that the SQL dump contains a lot of references to the IP address, and I have to replace it with: my_domain.com.
I could use sed
or some other command to change the that from the command line, the problem is that there are a lot of configuration data which uses JSON. So what? Well, as you know, JSON arrays uses things like: s:4:
to know how many chars an element has, and thus, if I just replace the IP with the domain name, the configuration files will get corrupted.
I used an app for Windows some years ago that allows to change values in a database and takes care of the JSON arrays. Unfortunately, I forgot the name of the app… so the question is: do you know any app that allows me to do what I want?
The data you’re looking at is not JSON formatted. JSON doesn’t (normally) store value types and lengths like that. What you’re looking at is SERIALIZED data. A google search for “mysql replace serialized” yields this page, which might help: http://davidcoveney.com/mysql-database-search-replace-with-serialized-php/