WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Error when importing database from live site to local (3 posts)

  1. PODxt
    Member
    Posted 4 months ago #

    Hi, I have 3 questions regarding local dev with wp.

    I have a live test site running (barely the 2013 theme with a couple of changes to test things out) and I installed wamp on my computer to be able to develop it offline. To do so,
    - I copy the uploads, theme and plugins folders from my live to local
    - export my live SQL database with phpMyAdmin
    - create a database on my local server with wamp phpMyAdmin
    - download and install the same wp version running on my live site (3.7.1), connect it to my newly created and empty database
    - wp now fills the database on its own
    - I then try to import my SQL database to my local site with the local phpMyAdmin

    But each time I try to import a database, I get the following error:
    http://img196.imageshack.us/img196/1997/8sp7.png

    By the look of it, it seems like it has something to do with the default comment (Hi this is a comment blablabla) but why would it create such error?? (1)

    Also when wp creates tables in my local database, the type is InnoDB whereas my live site database is MyISAM. How come? (2)

    Also bis, I was wondering if it was mandatory or recommended to reinstall wp each time I want to migrate a site from one location to another, even though there's already a wp installation running in the destination folder? When I look at how the duplicator plugin is working, it seems to reinstall wp all the time. So what's your routine? (3)

    Thanks ;)

  2. 2ninerniner2
    Member
    Posted 4 months ago #

    You got the process sort of correct, but a tad out of sequence and performed a step that wasn't required (which generated the error).

    - export live db
    - download the complete wp_contents folder
    - create a new, empty db locally
    - import the exported db into this db
    - extract the WP ZIP where it needs to be locally, and replace the wp_content folder with the one from the live site
    - DO NOT RUN THE INSTALL! - this is why you got the error, because doing so populated the db before you tried to import the live one :)
    - edit the local wp_config.php for your local db credentials
    - via phpMyAdmin, edit the wp_options table for the local siteurl and home fields
    - you will now be able to access the site.

    You did not have much content, so there should be no need to run a search and replace for any links to images, etc. But on one that is "fully built" live, you will. These are the two that I use and are quite popular:

    - http://wordpress.org/plugins/velvet-blues-update-urls/
    - http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

  3. PODxt
    Member
    Posted 4 months ago #

    Thanks a lot for your detailed reply! I understand now.

    Yes it seemed quite odd to me to reinstall WP each time one wante to move the website location.

Reply

You must log in to post.

About this Topic