Last updated 20 February 2015. Created on 19 February 2007.
Edited by HongPong, dgorton, add1sun, flickerfly. Log in to edit this page.

This writeup is somewhat dated. The main migration information is located around here. The Migrate module handles sophisticated transitions. The Backup & Migrate module can help perform basic site moves with optimized database dumps.

For older Drupal sites start with Moving entire Drupal site with databases.

This might help too: Backing Up Your Database

One approach for moving a Drupal 5.x site

I know the "official" process is to load the "tar" file to the host and unpack it. As an alternative, one can copy the code directly from your test site on your PC. I've tried uploading code from my machine twice with disastrous effects. (Okay, so I was born blonde!) So, I've worked out my own process that works. [By the way, this also reduces the bandwidth usage for those who might be running short on that.]

What has always worked for me is to install Drupal with cPanel/Fantastico (I know there are some people out here who will speak ill of Fantastico, but it has always done me right). Now, to be fair, one needs to understand what Fantastico can and cannot do.

Fantastico only supports core functions. It does not support custom themes, contributed modules, or custom code (outside of content). Fantastico does not use "update.php" (as a matter of fact, doesn't even load it), so it is not a good idea to use it to upgrade your installation. As long as you understand this, you're much less likely to have problems.

Make sure that the correct versions of modules and themes are working on your test site.

Here's my process: (by the way, this should pretty much work for changing hosts as well)

  1. Keep a pencil and paper handy to write down what changes you have to make. You can use this if you need to restart, or to think about changes to your site that slow down moving to new releases.
  2. Use phpMyAdmin (on some hosts, it's hidden under MySql) to back up your live database. If you have a site that is actively receiving new content, you may have to put the site into maintenance mode to prevent losing new content.
  3. It would also be a good idea to back up your test database, just in case...
  4. Import the database into your test site.
  5. Download any pictures you've uploaded and any folders that are created by the modules you have installed.
  6. If your live site and test site are not at the same version, you will need to run "update.php."
  • Open your browser to your test site. Don't panic if everything looks strange, or even blank.
  • In the URL bar, append "update.php" and press Enter. If it says you don't have the access rights, don't worry.
    • Using Notepad or similar text editor, open "update.php".
    • Near the top, you will see:
      // Enforce access checking?
      $access_check = TRUE;
    • Change it to FALSE and save it.
    • Try "update.php" again.
    • If you have any errors listed, search the Drupal site for fixes. There's a good chance that someone else has had the problem. If it appears to be a new error, post a request for help. Take your site out of maintenance mode and plan to start over when it's fixed.
    • Change $access_check back to TRUE.
  • If you had a custom theme, you probably need to re-enable it for the site to look right.
  • Now check out all your module settings. They'll probably be okay.
  • Look through your content, especially the front page. Make sure your menus are correct.
  • Check out any content that uses custom code, especially if you are changing Drupal versions.
  • Does everything check out? Good, you've done all the real work. Now the easy(er) part.
  • Okay, now it's time to do the damage. For me, the rest of this takes less than 15 minutes, so the outage to your users is minimal.
  • If your current site was installed with Fantastico, delete the current installation. If not, then you have to manually remove all the folders.
  • Now tell Fantastico to install the current version. Leave the directory field blank to put it in your "root" directory (probably "public_html"). The userid and password you supply will be your "super user" (user/1).
  • When it is done, I always tell it to email me the installation summary.
  • If you have any customized themes, non-core modules, or pictures, upload them (FTP) to the correct places on the server.
  • If there were pictures or module-related folders, upload them now.
  • When that's done, use phpMyAdmin on your test site and create a back up.
  • Then go to your cPanel again and invoke phpMyAdmin. When you get there, select your Drupal database and then "Import." There's a section to locate the back up on your local computer (Browse). Find it, and then Click on the "Go" button.
  • If you have a customized theme, go to Administer>>Site Configuration>>Themes and enable it. [Hint: Do not panic if your site looks weird at first. Remember you can always login with (yes, "user," not your ID.]
  • If your test and live directories are not identical, you may need to update IMG links, etc.
  • You should be in business.
  • One more little bit of business if you used Fantastico: go to the main Drupal directory on your PC and copy (FTP) the update.php script to your server. I don't know why they leave it out, other than they don't use it. You may need it later.

    Looking for support? Visit the forums, or join #drupal-support in IRC.


    RobLoach’s picture

    The Demonstration Site module allows you to create complete database snapshots of the site. The Demonstration Site Install Profile will allow you to make use of these snapshots from install.php.

    rpmskret’s picture

    Thank you for you guidance. I am getting things going well from it.

    Perhaps others could benefit also from my good luck. I read this whole page and many of the comments at Moving entire Drupal site with databases. From those comments I followed advice to

    1. turn off clean urls at admin/settings/clean-urls
    2. run cron from admin/reports/status
    3. clean the cache from admin/settings/performance

    Then packed the whole local drupal directory with .zip. Uploaded to remote server and unpacked. First time around for me with cPanel > Files on the remote server. You browse to your archive and right click and unpack. Next exported local dBases then imported them into remote dBase from phpMyadmin. Edited all sites settings.php files to match remote dBase and user:password names. The site is working great. Bought a second domain name for now, "Parked" it at the same drupal site and have multisites working.

    Beata43’s picture

    I failed to transfer the whole website to another server.

    1. I have installed new installation
    2. I have upload images and files
    3. Mysql redused double by importing all files from old site which were installed automatically (drpl_...)
    4. I didn't see content, the result: I should do all content (pages) again (copy-paste)

    As I am experienced with Joomla: by importing Mysql, the all website appears at once

    So I need to do Drupal website again !

    schildi’s picture

    the process of moving a complete site is simple. I do it about once a week.

    • Setup a config file for each site in {drupal}/sites/{domainname}/settings.php
    • create the archives:
      tar zcvf {drupal-dir} {archive-name}.tgz
    • dump your database
      mysqldump -u {db-user} {db-name} -p > {archive-name}.sql
    • using ftp/sftp put the archives on the remote host
    • check under which user and group the remote server is running (use info.php)
    • go to (above) the destination directory
    • and unpack the archive
      tar zxvf {archive-name}.tgz
    • change ownerships if needed
      chown -R {user}:{group} {drupal-dir}
    • load the database
      mysql .... -p < {archive-name}.sql


    Beata43’s picture

    * settings.php - I did
    * "create the archives:" - where, how? I export MySQL - isn't enough?
    * how to dump data base?
    * remote host - what it means ? and so.on :-(

    Please help me

    schildi’s picture


    1. create a directory named as your domain:
      cd {drupal}/sites
      mkdir {}
      cp -p default/default.settings.php {}/settings.php
      if needed: chown -R ... {}
    2. edit the new settings.php file and modify the "mysql" line to fit your database /user/password settings
      see line: $db_url = 'mysql://username:password@localhost/databasename';

    Dump database: As explained type
    mysqldump -u {db-user} {db-name} -p > {archive-name}.sql
    the switch "-p" means you will be queried for the password
    Fill in your db-user and db-name. Redirect output to YOUR file {archive}.sql

    Remote host:
    The server to which you want to migrate the installation

    Beata43’s picture

    Sorry, but your codes are not clear to me:

    cd {drupal}/sites
    mkdir {}
    cp -p default/default.settings.php {}/settings.php
    if needed: chown -R ... {}

    1. I did a copy of default.settings.php and renamed settings.php
    2. I have edited new setings of MySql in 2 lines

    Where to do this? Where to type?????

    mysqldump -u {db-user} {db-name} -p > {archive-name}.sql
    the switch "-p" means you will be queried for the password
    Fill in your db-user and db-name. Redirect output to YOUR file {archive}.sql


    Beata43’s picture

    1. I have imported MySql from original website but by upating I keep having many errors like this for css and js:

    warning: unlink(sites/default/files/css/3777033de653b310c7590f23912dab87.css) [function.unlink]: Permission denied in /home/anre/domains/ on line 459.

    How update database manually, I don't know

    2. Another question: I had clean Drupal installation on the new website. The old installation was done automatically from Elefante free scripts. My sql became now imported with all tables which begins drpl_
    So, now I have doubles tables. Is it good ?

    Is it Ok move Drupal in this case?

    schildi’s picture


    to migrate the installation you have to do two or three things:

    • migrate the database
    • migrate the files
    • if needed: adjust ownerships of files on new server (normally UNIX/Linux)

    In details:

    • export your database: you did it already
    • import of database on new server: you did it, but:
      There was NO hint to do a fresh DRUPAL installation on the new server. DON'T DO IT!
      If you do a fresh install and afterwards migrate an existing installation to this server/database then databases/files might be mixed up!
      That seems to be the case in your situation.

      Reset the database (drop ALL tables) and do an import from your dump/export.
      Erase ALL files of the new installation (will be migrated from old server!).
      It's much more easy than you expected. No preparations on the new server have to be done.

    • import your dump again into an EMPTY database.
    • copy all files of your old installation (module, sites, includes,...) to the new destination directory.
    • ensure that the setting in settings.php to access the database are correct

    When there is a table prefix defined - like drpl_ - on your old installation then this is also declared somewhere in the settings.php file. Just take a copy of the old settings.php and modify if to access the new database. Nothing else is needed.

    Conclusion for your migration:
    * Don't make a fresh install on the new server
    * just import your dump to the new database
    * copy all files
    * adjust settings.php


    Beata43’s picture

    Thank you, I will try it, but I think that it would be better to do everything again from null

    That is surprise for me, - to import MySql without installation !

    Really I tried this also, after installation I have deleted all tables and than imported MySql, but got errors

    What happenned else today ! I have exceeded MySql quota in original server by activating some module, I tried to delete something in MySql but of course I have damaged MySql

    As you advised I have deleted all tables in my original (first) server and tried to import MySql which I backuped in April (the same server, the same MySql ) and got errors:

    many errors (by indicating compression automatically, gziped), later when I tried to import bzip I got only one error but can't define it in MySql:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-5' at line 1

    I don't find this error and I can't even restore my old website :-(

    schildi’s picture


    I'm really sad to read that you got no success. And what I wanted you to do is to erase all tables from the NEW server so the database is clean before importing the tables.
    What kind of database export/dump do you have? Is it a text file holding a lot of sql commands to set up tables and import rows? Then it must be possible to import it again. When the dump is compressed you probably have to expand (uncompress) it before importing. Do you use the command line or some tool to import the dump? And of course the dump and the backup of your drupal system / files must be from the same date. Are these conditions fulfilled?

    By the way: Importing a database from a dump creates all tables and inserts all rows. So an import from a (complete) dump IS half of an installation. The other half is to restore the files.


    Please, for further questions contact me by email.

    Beata43’s picture

    Today i am going to upload all installation files to new place (third server) and do Drupal website again from null. I have in my second server all files (, thefore I can copy-paste to the third server. Maybe I will try to import some MySql from the first server which I have saved before this happened on my first server but I already don't believe a success.

    I will try to answer all your questions:

    Usually I export MySql in zipped text file and import also zipped. I do it by indicating automatically. There are four options to import: automatically, no compression, gziped and bzip. Yesterday as I wrote, only the last gave me one error but I didn't know how to improve this. All tables has been deleted before it.
    Today I tried to import MySql unzipped by indicating "no compression". I failed and got this:


    What it is?

    You wrote: "And of course the dump and the backup of your drupal system / files must be from the same date". In this case I am on the first server and want only to restore previuos MySql
    Today I tried again to restore MySql in my first server tring all methods and only the last gave me the same error:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-5' at line 1
    How to improve it, I don't find

    So I leave my first server without restoring, this is free hosting with 10 Mb Mysql
    although I have installed Drupal again, because there was many errors although all tables has been erased

    As for moving to second server (something already works but there are many errors when I am trying to update and don't know how to improve them This is done by successfully importing MySql from first server, but the files didn't appeared and I did everything manually)

    Please explain me: "the dump and backup", what it is ? What do you mean? Do you mean that I have put all Drupal files on new server by copying from old? - when I move to second server ? - please answer.

    Sorry, I am not English speaker...

    I put new installation files and of course a little higher version. Is this isn't OK?
    I import MySql and I am waiting that everything will find their places (all files like in Joomla)

    Thefore I thing I need to start again in the third server :-)

    unleash’s picture

    hello dear friends

    i have installed a drupal commons on a local lampp and now i want to port it over to the webserver. is this very vrery difficult?

    what do i need to take care - which lines in the settings.php have to be edited.

    greeetings unleash