Setting up test site using other site's data in separate database (2 posts)

  1. cannolo
    Posted 6 years ago #

    I've been trying to set up a test site, and something strange happened. The test site is on another domain. It reads from a separate database that's loaded with data from the public site.

    The problem began when I imported the public site's db into the test site. Now when I try to log into the test site, I can't even reach the log-on page. Instead, the browser switches to the public site.

    Question: What do I do now? How can I run the test site using the public site's data that's read from a separate database?

  2. stvwlf
    Posted 6 years ago #


    First read this

    Then, if you understand what I've said below, here is the method I use to accomplish what needs to happen:

    I do a database backup of the whole "new" WP database. That creates a text file of SQL code to recreate the database from scratch.

    I keep a backup copy of that file before making these changes.

    I load the SQL file into a text editor (NOT a word processor) - on Windows Notepad works if you don't have a text editor). I then do a search and replace - replacing every instance of the old WordPress install URL olddomain.com/blog with newdomain.com/newfolder

    In phpMyAdmin, I delete all the tables in the database. Using phpMyAdmin Import I load the edited SQL file. The result of this is every reference in the database point to the new domain.

    The backup copy is important in case something goes wrong. Using it you can restore the database in 5 minutes.

Topic Closed

This topic has been closed to new replies.

About this Topic