Site Building
Topic

Back up Your Drupal Site for Drupal 7, 8, 9, and 10

A reliable backup will allow you to restore your site if something goes wrong, whether it is a server failure, site code or database problems, or user error. Everyone should have a regular back up schedule for their site, and know how to restore the site from those backups. A new backup should also be created before every update of core or a contributed project made to a site. For a Drupal site, you need to make sure to have backups for both your site code, including your site-specific settings and files, and the user-generated content that lives in the database and filesystem.

Example tasks

  • Back up a database and user-generated files
  • Back up Drupal site code
  • Restore a Drupal site from backups

Confidence

Backups are not an integral part of Drupal itself; the procedures and tools are widely used across all web applications. This means the information is widely available and reliable.

Drupalize.Me resources

Quick reference

Using Drush:

drush sql:dump --gzip --result-file=backup.sql

Or using mysqldump, replace {DATABASE_NAME} with the name or your MySQL database:

mysqldump -q --opt --add-drop-table {DATABASE_NAME} | gzip > backup.sql.gz

Both examples will result in a file named backup.sql.gz that contains a compressed backup of your database.

Drupal 8, 9, 10, and 11
More information

Overview of data backups and what should be backed up on a site.

Drupal 8, 9, 10, and 11
More information

How to make a copy of a live site for development purposes.

More information

In this Lullabot Module Monday lesson we take a look at the Backup and Migrate module. Few things are more terrifying than the realization that a server hiccup has wiped out a web site, or a hasty change deployed to the live site has nuked important content. Fortunately, there's a module that can help. Backup and Migrate offers site builders a host of options for manually and automatically backing up their sites' databases, and integrates with third-party backup services, to boot!

Additional resources

More information

Updating your site often sounds much scarier than the actual experience is. The most important step to remember is creating and testing backups of your site. In this lesson, we will create our backups, download a new version of Drupal core, and go through the process of updating our files and running the update.php script.

Note: Not mentioned in the video is the fact that in addition to the user 1 account, you can also log in with any account that has the "administer software updates" permission enabled to run the update.php script.

Additional resources

Drupal.org Upgrade Documentation

Using Drupal, 2nd edition

Using Drupal source code

Drupalize.Me Guide: Using Drupal Book by O'Reilly Media

Guides

Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources