Backing Up and Restoring Drupal Using a Migrate Module

To sustain this free service, we receive affiliate commissions via some of our links. This doesn’t affect rankings. Our review process.

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.”
About The Author:

Alex has been involved on the business side of the internet since the early 2000's. He holds both a Management Science degree from the University of California at San Diego as well as a Computer Science degree from NJIT.

We Rock Your Web had its roots back in 2004 as the tech blog for a web design and development company Alex founded that has grown and evolved into the parent company of We Rock Your Web.

While his foundation is rooted in web development, his expertise today lies in content and digital marketing, SEO, organic and paid search, analytics, and publishing. Alex is an avid tennis player, nature enthusiast, and hiker, and enjoys spending time with his wife, friends, and dogs.

Disclaimer: This website contains reviews, opinions and information regarding products and services manufactured or provided by third parties. We are not responsible in any way for such products and services, and nothing contained here should be construed as a guarantee of the functionality, utility, safety or reliability of any product or services reviewed or discussed. Please follow the directions provided by the manufacturer or service provider when using any product or service reviewed or discussed on this website.

New comments are closed at this time.

Comments (9)