Migrating a previous Drupal 6 Installation

*Edit: I’m in the process of adding more information and images to the tutorial*

Before we begin:

For this tutorial I’m using MAMP and a previous installation of Drupal 6. We are going to be moving the previous Drupal installation onto a new computer and reinstantiating it so it is identical to the previous install. To do this you need the previous installation folder and a backup of the SQL database.

Now lets start.

Copy your Drupal site folder into the htdocs folder of MAMP (or htdocs of whichever local web development environment you are using).

Navigate to the “default” folder which is located in /htdocs/sites/default.

Make a new folder on your desktop called “default”. (The purpose of this step is to avoid getting the privilege errors when using a drupal installation that was originally used on another computer or one that does not have privileges allowed on your computer. This can be bypassed by chmod 755 your “default” folder but it does not always work for everyone so this is an alternative way).

If a “files” folder exists in your “default” folder, copy over the “files” folder from /sites/default/ into your “default” folder on the desktop.

Navigate back to /htdocs/sites/default and open up default.settings.php from in your favorite text editor. Save it as default.settings.php and as settings.php in your “default” folder on your desktop.

Now delete the “default folder” in /htdocs/sites/ and copy over the “default” folder from your desktop into /htdocs/sites/  (What this essential does is get rid of the restricted permission on the default folder and allow you to have full rwx control since you created the folder).

Open up your preferences page in MAMP and click on the phpMyAdmin page. Go to the ‘privileges’ tab, then click add new user.

Select a username, in this case you can call it “drupal”. In the Host drop down box choose local and it should fill in the field with “localhost”. Choose no password from the password drop down (less secure), or use text field if you wish to use a password.

In the Database for user box, select the second option, “Create database with same name and…” then scroll down to the bottom and hit go.

You should have a user and database with the name drupal created (you can see the database name on the left).

Now back to the “default” folder in /sites/ open up the settings.php and scroll down to the $db_url variable. It should look like this  $db_url = ‘mysql://username:password@localhost/databasename’;

Change the $db_url variable to match your database information you previously created. Mine looks like this  $db_url = ‘mysql://drupal@localhost/drupal’;

You are now ready to install your drupal site.

Navigate to your browser and type localhost:8888 in your url bar.

Drupal should start the installation page.

On the page asking for database information, enter the information you previously created.

On the next page, the information you choose is up to you (the admin email, password, etc…)

Your drupal installation should now be complete. The only thing left to do is import your previous database information into the new drupal database.

To migrate your previous .sql databse go to phpMyAdmin and select the drupal databse on the left hand side. Now go to the import tab (rightmost one) and choose the file location of your previously exported .sql database. Hit go and you should be set.