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.”

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.

Alex bring a series of in-depth articles on search marketing and content management systems as well as troubleshooting tips to We Rock Your Web's collection. He is an avid tennis player, nature enthusiast, and hiker, and enjoys spending time with his wife, friends, and dogs, Bella and Lily.

9
Leave a Reply

avatar
newest oldest most voted
Anonymous
Thank you for providing the phpmyadmin backup/restore tutorial. It saved me a lot of time.
Anonymous
I feel a little bit safer at least having the database file on hand. Thanks for the concise step-by-step.
Anonymous
When I press the Go button, it appears to
Anonymous
….do nothing. Should it come up with a window asking me where I want to save it?
Anonymous
How do you restore the file system? And is there a modification(s) I have to do if so?
We Rock Your Web
Drupal’s file system is not stored in the database – you’ll want to back this up separately – either by keeping a local copy and your hard drive or using your control panel’s file backup feature.
Anonymous
I would like to say…Thank you for providing the phpmyadmin backup/restore tutorial. It saved me a lot of time.
Anonymous
The backup and migrate module saves the time taken by all these manual steps. Simply download it, and set it up to backup your data 24/30 (every night for the last 30 days) and you’re set.