Skip to content

Use Search Replace DB to migrate Wordpress content to a Fresh install

danelige edited this page Feb 19, 2017 · 1 revision

Starting point: https://www.smashingmagazine.com/2013/04/moving-wordpress-website/

Search Replace DB explanations need more details:

  1. When migrating Wordpress to a new host, create a new cPanel with the new host.
  2. The domain of that cPanel will be temporary (usually: servername/~cPanel username. for example http://xxxx.server.com/~mynewcpanel)
  3. Install a fresh WP (through Softalicious for example)
  4. You will have a DB for the fresh install (e.g. mynewcpanel_db1)
  5. Create a new DB (call it with “m” for migration at the end = mynewcpanel_db1m)
  6. Assign the same DB user as the fresh install auto-created already. You can do that under cPanel > MySQL Databases.
  7. Go to cPanel > phpMyAdmin.
  8. Click on your new database “mynewcpanel_db1m” and import your old WP database that you exported (structure and data). Do that via the IMPORT tab.
  9. Put Search Replace DB folder into your fresh WP install directory. Call it “search-replace-db”.
  10. Open Search Replace by typing http://xxxx.server.com/~mynewcpanel/search-replace-db.
  11. Initially do a dry run. It may throw up errors because the table prefix is different (“wp_” for example) - click on “update details”.
  12. Check if the changes of the dry run look correct by clicking on “view changes” below.
  13. Do a LIVE RUN to make all the changes.
  14. Zip the existing wp-content folder in the fresh install (just in case, keep it for now) and delete it. You will have no wp-content folder in your new install after that.
  15. Upload your zipped and downloaded wp-content folder from the old WP install. Unzip it. You should now have a wp-content folder again.
  16. Zip the "search-replace-db” folder for later use. And delete the folder (keep the zip). This is IMPORTANT for security reasons ! ! !
  17. Go to wp-config.php and change database name. Add an “m” so that: define('DB_NAME', 'mynewcpanel_db1m’);
  18. Change the prefix to your old db prefix: $table_prefix = 'wp_’; (replace “wp_” with whatever you used - “wp_” is the default option)
  19. Go to http://xxxx.server.com/~mynewcpanel/wp-admin
  20. Wordpress will start a short settings request: user, pw, email - just input what you prefer the settings to be.
  21. If Media Library images somehow do not show up on your site, delete the .htaccess file (it will be regenerated if necessary, and see this:

Thats it. The fresh WP install now looks like your old WP content, including media library.

Useful plugins if something goes wrong with the Media Library: https://wordpress.org/plugins/add-from-server/

Clone this wiki locally