A PHP search replace tool for quickly modifying a string throughout a database. Useful for changing the base URL when migrating a WordPress site from development to production.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 130 commits behind interconnectit:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Search Replace DB

This script was made to aid the process of migrating PHP and MySQL based websites. It has additional features for WordPress but works for most other similar CMSes.

If you find a problem let us know in the issues area and if you can improve the code then please fork the repository and send us a pull request :)


  • Migrate all your website files
  • Upload the script to your web root (or the same folder as wp-config.php)
  • Browse to the script's URL in your web browser
  • Follow the on-screen instructions

CLI script

  1. Run the CLI script from the command line like so: ./searchreplacedb2cli.php --host localhost --user root --database test --pass "pass" --charset utf\-8 --search "findMe" --replace "replaceMe"
  2. use the --dry-run flag to do a dry run without searching/replacing

You can use short form arguments too so --host becomes -h and so on.


If you use some dynamic processing to setup the database definitions in WordPress try using the 'filestream' branch. Let us know if you find any bugs or have any suggestions to improve it.