Search and Replace for WordPress Databases

Search and Replace for WordPress Databases

So if you ever want to change the name of a WordPress or Drupal site you might be in for some fun. Somewhere along the line it became acceptable to embed serialized data into the database. This seems like a great idea (?) until you do a search and replace on exported database files, and notice that many things stop working.

Using serialized data like this in the Database goes against the grain. I’m sure Dr. Codd is rolling in his grave.

Luckily I have found a very useful script that I have used many times now and it works very well for wordpress, and in theory Drupal too.  It is from David Coveney and can be found here. Thanks Dave!

If you want to automate the maintenance of your Drupal sites the best tool is drush. It allows you to maintain modules, run sql queries, clear caches, show logs, run cron, and perform unit tests. Nothing more to say, but I only recently found this tool and if you love the command-line like I do this works like a charm.

I used to use zip for backups on our servers. I liked zip because it was fast and easy to use and worked easily on PCs too. Everything was great for a few years until our backups started hitting 2GB then zip did not perform so well. I tried various versions available on Linux and in the end decided it was nightmare trying to read the files. Since then I have changed all my scripts to use compressed tar archives: tar.gz. There appear to be no limitations on the file size with tar.gz, except for the file system itself.