There are many often complex and time consuming ways to copy a Drupal website from one webhosting company to another-one. This howto offers you instructions how to do it the easy way. It is based on the following assumptions: You have the same Drupal versions on both sides and Drupal is already installed at the destination.
Open phpMyAdmin and export all the tables of your Drupal installation. Select "Custom - display all possible options" and choose the option "Save output to a file". Verify that all tables are selected and export the database. Save the .sql file.
Before you import the database, you have to make a small modification to the exported database file. Open the database with a text editor and edit the following section. The 3 instances of xxxxxxxxxxxx represent the database name/user name of the exported database. To avoid access rights problems you have to replace it with the database name/user name of the database at the destination.
--
-- Database: `xxxxxxxxxxxx`
--
CREATE DATABASE IF NOT EXISTS `xxxxxxxxxxxx` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `xxxxxxxxxxxx`;
If you don't do it you most probably get the following error message:
#1044 - Access denied for user 'xxxxxxxxxxxx' to database 'xxxxxxxxxxxx'
After the modification you can import the database using phpMyAdmin.
Copy all customized elements from your Drupal installation folder at the origin web-server to the same place at the destination web-server. Usually all the customized elements are stored in the folder sites/all. Frequently you might have uploaded files in sites/default. If you have files in other folders, copy them too. Don't copy and overwrite the file sites/default/settings.php. If you do, you will have to modify the password in the following section (username and password you already adjusted by modifying the import file).
$databases = array('default' => array( 'default' => array(
'driver' => 'mysql',
'database' => 'xxxxxxxxx',
'username' => 'xxxxxxxxx',
'password' => 'yyyyyyyyy',
'host' => 'localhost',
'prefix' => '',
'collation' => 'utf8_general_ci',
)));
When you open the website at the destination, you should now encounter an exact replica of your Drupal website.* To complete the process you will be asked to run the "database update script". If you go to Reports - Status Report you will see the message "Some modules have database schema updates to install. You should run the database update script immediately." Run the script and you are done :-)
* A very common cause of a failure is to be found in the prefix of the database. You can modify the prefix in the settings.php in the folder sites/default. The prefix at the destination should be the same as at the origin database. Search for the entry 'prefix' => '',

Read more articles
- Log in to post comments