Backing Up and Restoring Drupal Using a Migrate Module

When you purchase through links on our site, we may earn a commission. Here’s how it works.

Drupal Backup and MigrateThanks to the advent of Drupal’s backup and migrate module (since Drupal 5.x), Drupal users are now able to simply install this module and specify backup settings. A manual and automatic backup directory will be created in your file folder (you may need to specify the appropriate write permissions – the module alerts will guide you through this). You can manually backup your Drupal database at any time, choosing to either download it to your PC or back it up on your server in your file system. In addition, you can specify an automatic backup schedule (make sure you have cron configured on your server or the poormans cron module installed) that will save backups of your database according to your time schedule (for example, you can set it to backup every 24 hours, and keep the last rolling 30 days of backups).

In addition, and this is the beauty of the backup migrate module, is that you can specify which tables are omitted. By default, your cache, temporary, and other non-essential data is stripped, giving you a lightweight, easy to import backup copy of your Drupal database. You can also use the backup and migrate module to import a saved or manually downloaded copy of your database easily. Please note that only your database is backed up, not your file structure.

Protect Your Data and Installation

Protecting Drupal data is slightly more complicated than a locally stored, static-file website, since all the data is stored in a database. Therefore the key to backing up your data is to backup the database. Here I outline a process that works for us. We do not make any guarantees as to the correctness of this information nor will we be held responsible for any problems you encounter as a result of its use.

My System

This worked for my system setup, but it may not work for yours, therefore we are listing our specs. At the time of this writing we were running Drupal 4.7.2, mySQL 4.0.27-standard, PHP 4.4.2, and phpMyAdmin 2.6.4-pl2.

Backing Up Your Drupal Database

  • Open phpMyAdmin
  • Select Your Database
  • Click Export
  • Under Export Click “Select All” and Select “SQL”
  • Under SQL Options
    • Important: Different hosting providers use different versions of mySQL. If you are backup up a database from one host and importing it to another, make sure to match up the mySQL versions under the “SQL compatibility mode” drop-down. For example, if you are backing up a mySQL DB in a hosting environment running mySQL 4.1, and importing it into a 4.0 environment, you will need to select “MYSQL40” from the drop-down (it defaults to “NONE”). You can check your mySQL (and PHP) versions when you first log into your admin interface (ie. in cpanel on the left-hand side).
    • Select Structure, Add DROP TABLE, Add IF NO EXISTS, Add AUTO_INCREMENT VALUE and Enclose table and field names with backquotes.
    • Select Data, Complete inserts, Extended inserts and Use hexadecimal for binary fields.
  • Select Save as file
  • In File name template: _DB_your db goes here. (Here you can use any name you want)
  • In Compression specify your choice (compression recommended for large-sized files).
  • Click Go.

Restoring Your Drupal Database

  • Open phpMyAdmin
  • Select Your Database
  • Click Import (or SQL if you don’t see an import tab in your environment)
  • Browse to the location of your Drupal database backup file.
  • In Compression Select the option you chose to export the database (or “autodetect”).
  • In “format of imported file” select the SQL version that matches the SQL version running on the host you exported the database from.
  • Click Go. You should see a message to the effect that “x number of queries were executed successfully.”
Tagged With: , ,

The information provided through this website should not be used to diagnose or treat a health problem or disease; it is not intended to offer any legal opinion or advice or a substitute for professional safety advice or professional care. Please consult your health care provider, attorney, or product manual for professional advice. Products and services reviewed are provided by third parties; we are not responsible in any way for them, nor do we guarantee their functionality, utility, safety, or reliability. Our content is for educational purposes only.

Notify of
Oldest Most voted
Inline Feedbacks
View all comments