Forums

backup resulted in localhost showing Live site! (15 posts)

  1. colsut
    Member
    Posted 3 years ago #

    I downloaded a backup from my live website and restored it to my local host via phpMyAdmin because I wanted to have an exact copy of the real site on my local machine.
    But now when I click on to localhost it doesn't point to my local machine but to the live website - would appreciate help to get out of this one!
    thanks

  2. doodlebee
    Member
    Posted 3 years ago #

    When you imported the backup to your localhost, did you remember to change the stuff in the SQL file to reflect your localhost settings? Or did you just backup the live site and the import to your localhost machine?

    Most likely, your database settings (and perhaps even your table prefix) on your localhost isn't he same as your live host. When you do this kind of thing, you have to open up the SQL file in a text editor, and change the database settings to reflect the proper database. If you don't do that, then what you're seeing will generally happen.

    At this point, what I would do is drop the database from your localhost (and get that back) and then open up our SQL file and make the necessary changes (usually, it's just a matter of changing a couple of lines at the top of the file, so it points to the right database, as well as changing the wp_options area to reflect the correct home URL and site URL). Also make sure your wp_config.php file has the connection settings to your localhost machine, and not your live site. Save (and "Save As" - don't overwrite your backup) and import *that*.

  3. moshu
    Member
    Posted 3 years ago #

    At this point, what I would do is drop the database from your localhost (and get that back) and then open up our SQL file and make the necessary changes (usually, it's just a matter of changing a couple of lines at the top of the file, so it points to the right database, as well as changing the wp_options area to reflect the correct home URL and site URL).

    Aren't we over-complicating it?
    If you have a local install, probably, you have phpmyadmin, too. Edit the "home" and "site_url" values in wp_option table. Done.

  4. colsut
    Member
    Posted 3 years ago #

    moshu, I've tried you're solution before attempting doodlebees but can only see "site_url" in the wp_option table.
    I changed that to http://localhost/ and pressed go in phpMyAdmin but it hasn't solved the problem.
    Where is the "home" value in phpMyAdmin?

  5. moshu
    Member
    Posted 3 years ago #

    When showing those options the table rows are "paged" - click on those > signs to go further :)

  6. colsut
    Member
    Posted 3 years ago #

    Moshu

    thanks for that
    I am now back on my localhost environment which is brilliant
    unfortunately, even though I can see the home page of my website, clicking on other pages just gets me:
    The requested URL /contact was not found on this server.
    I guess that might have something to do with the backup I tried to restore using plugin WordPress Database Backup 2.2.1
    It looks like I might have to start again (but more carefully next time)
    all I wanted to do was set up a local copy of the website so that I could experiment/make changes safely!
    Anyway, thanks very much for your help

  7. moshu
    Member
    Posted 3 years ago #

    Set your permalinks to default (on the local install)!

    Sidenote. Now, I do have many local installations to experiment with themes and other solutions. However, I find it insane to import the database of whole my online blog just for the sake of design experiments...
    Just my $0.02

  8. colsut
    Member
    Posted 3 years ago #

    i'm very new to all this and the website really is very small at the moment. Even the word permalinks is new to me!

  9. colsut
    Member
    Posted 3 years ago #

    but "a bit insane" is a bit more familiar somehow?

  10. moshu
    Member
    Posted 3 years ago #

    Well, when you are so new... maybe you should start getting familiar with your own WP admin panel (all the subpanels and their features) before attempting something like this local install.

    admin > Settings > Permalinks

  11. colsut
    Member
    Posted 3 years ago #

    sorry - didn't realise I needed to be an expert before I asked for help

  12. moshu
    Member
    Posted 3 years ago #

    Don't need to be an expert... but it is a reasonable expectation that you take a look at the tool you are using.

  13. colsut
    Member
    Posted 3 years ago #

    ...
    but I've got to say thanks again
    your advice has been much appreciated and has been spot-on
    my local site is up and running again
    I will find my way around eventually, just a lot to learn in a short space of time just now. It's a church website and nobody else knows how to do it either.

  14. Otto
    Tech Ninja
    Posted 3 years ago #

    For testing with live data on my own machine, I add extra defines to my own machines wp-config.php file:

    define('WP_HOME','http://localhost');
    define('WP_SITEURL','http://localhost');

    This overrides the database settings and lets me not have to screw with it every time I update the local database.

  15. colsut
    Member
    Posted 3 years ago #

    thanks for that Otto42
    I've just amended my wp-config.php to include those defines - just in case I manage to mess things up again

Topic Closed

This topic has been closed to new replies.

About this Topic