Best Practice to Export and Import Drupal Website?

Posted on 2012-09-12
Last Modified: 2012-10-02
I developed a Drupal 7 site on my local machine and want to share that with another party who has an equal WAMP stack Drupal environment.

So what's the best way for me to export my site and zip it over to them?
Question by:sandshakimi
    LVL 50

    Assisted Solution

    by:Julian Hansen
    1. Backup the site files
    2. Dump the database

    With 2 dump the database without the create database / use database option

    The files you can zip (or tar and gzip) whichever you prefer.


    1. Create a root for the site
    2. Extract the archive
    3. Create and load the database to the database on the target machine
    4. Truncate the cache tables
    5. update /sites/default/settings.php with database settings.

    That should be all that is required.

    Author Comment

    Can you clarify the dump process?

    Can I do this via phpMyAdmin. I have more experience with GUI than using MySQL command line.

    But I can do whichever is best practice. With command line, I need specific steps.

    LVL 50

    Expert Comment

    by:Julian Hansen
    You can with PhpMyAdmin but best to do it with mysqldump as follows


    backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

    Open in new window

    To restore you can use PhpMyAdmin as well or you can do it on the command line by logging in to MySQL and using source
    mysql -u root -p[root_password] [database_name] 
    source dumpfilename.sql

    Open in new window

    You can do it in one command like so
    mysql -u root -p[root_password] [database_name] < dumpfilename.sql

    Open in new window

    But then you need to make sure that dumpfilename.sql has a USE database statement for the target database if it exists already otherwise a create database and use database if it does not.

    PhPmyAdmin - will depend on your server setup (hosted) as to what functions are available.

    You can also look at tools like SQLYog which if you have direct access to the database is far superior to PHPMyAdmin.
    LVL 29

    Accepted Solution

    WARNING: when you are moving a drupal site from one place to the other, first take 40 seconds to clear all the caches (in the "performance" tab).

    WHY: Otherwise the database will keep track of the "existing" (on the old site) files, and you might have problems for the site to update itself
    LVL 17

    Assisted Solution

    Wait! Use the module called Backup and Migrate, it is so simple!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now