I have a drupal site setup on one server. However I want to move it to another server. New domain name, include files in different location, is even in a different country.

Is there an easy way to achieve this without having to start from scratch. As in migrate all content and user accounts.

Regards, Bawdo2001.


Gunnar Langemark’s picture

There's always a way with Drupal.
Only local images are allowed.

All you need is to export your database, and copy your Drupal files.
Then you need to change the conf.php info, and perhaps your cron script.

First export the database to make sure everything is there, if anything goes wrong. You do that in phpMyAdmin if you have access to this excellent tool.
Find your database and make a "dump" by checking "Structure and data" - makes sure that both the structure of the database the tables, and the content you have on your site - is with you!
Also check "drop table" - so that if the new site is installed already, you can install your database on top of that. "drop table" simply ensures that if the table exists - it will be replaced by the one you backed up.
You also check "Send" - to be able to download the backup to your own local machine, and "complete inserts" to make sure it does not miss anything when rebuilding the site.

Now when you've made your backup, it is a good idea to test it before you close down your old site. You are probably able to build the database on the new site before you move the domain there.
When you've successfully installed the db you can test it by pointing your existing site to the new database.
If it works you have an updated database all the time, but if it crosses countrys it might not be a good idea to do this for more than a few minutes.

Now you need to move your files. Move all files - and after moving them you open conf.php in a text editor and change the db settings to the new db and the base url.

If you run cron make sure to change this also in /scripts/cron-lynx.sh - so it points to cron at your new site.

Now you should be ready to move the domain so it points to your new IP number.

That's it.

Gunnar Langemark

Jesse Sanford’s picture

... the new site seems to have php 4.3.7 and i've configured apache, but the html output by my theme engine (modified bluemarine) doesn't include line breaks, omits some tags entirely, and adds color tags to my body tag thus overriding my style.css. And the logo isn't displayed and the blocks are in the wrong place.

I don't see any error messages, though. But the site looks awful. How would I even begin to fix this problem?

varr’s picture

I am having a similar problem.

I exported/imported the database successfully.
Copied all of the files over successfully.

Except now when I look at the site, it's as if there's no css formatting.
Any attempt to switch themes doesn't make a difference.

Anyone have any ideas?

Varr Willis
Semantic Effect

"This space intentionally left blank"

drac.sa.evas’s picture

I'm experiencing exactly the same problem. I just move the site and it's as if there's no css formatting. I switched the themes many times and nothing changed. Did you solve it??? Anyone else had the same problem?

bawdo2001’s picture

I was doing it pretty much the same way that you suggested.

It turns out that by removing CHARSET=latin1 from all of the Create Table queries I could migrate the data over.

There is still one problem that I can work around by disbaling the "Who's Online" block.

I think this may be associated with some limitation of MySQL 3.22.32 that the site is now using.

I will investigate this problem (and define it a bit better) later on when I have more time.

Regards, Bawdo2001

umina’s picture

I just tried this in May of 2009 and obviously had the same problems as th previous posters. The symptoms came form the fact that the server got confused between the new site and the old site for some references which is caused by a line in sites/default/settings.php.

The offending line is:

$base_url = 'old site url reference';

to make the themes work you must update this line to point to the location of the new installation. Whats really
neat about this is you can tell drupal that the new site is in a folder if you need to. Just remember, no trailing / on
this line.

The other line you should be aware of starts with:

$db_url = mysql:.....

If your username and password for the table you create is different for the new site you need to fix it here.
Fortunately if drupal fails the msql error is reproduced (at least on my installation) which helps you to understand
what's going wrong with the mysql server part of your installation.

The format of this line is:

$db_url = mysql::@/

for example:

$db_url = mysql:tom:SuperDuperGuy@localhost/tomsdb

= tom
= SuperDuperGuy
= localhost
= tomsdb

I have not tried it but my guess is that you can substitute any system name like mysql.power.com for local host and it will work find, it might need to be quoted.

Len Umina


ccg121’s picture

I Backed up my site then re-did my server with a different Control Panel which created a different directory structure /var/www/vhosts/user/site.com/httpdocs I put the files into the httpdocs folder and put the database back correctly (I think) I can see the main page but clicking on any links gets me a Not Found Message I have tried running update.php and I cannot access /user/login

m3fan’s picture

I just did the same thing today. First page looks great, no other links or pages work at all. Definitely in need of ideas!

nikhilesh.mr’s picture

Looks like you missed .htaccess file while moving.