Bobcares

Drush Backup Database | Guide

by | Jun 1, 2023

Learn more about Drush Backup Database from our experts. Our Drupal Support team is here to help you with your questions and concerns.

Drush Backup Database | Guide

Did you know that we can easily take a database backup using Drush with the drush sql-dump command?

Drush Backup Database | GuideAccording to our experts, we can run this command as seen below:

drush sql-dump > backup.sql

This command creates a SQL dump of our Drupal site’s database and saves it to a file named “backup.sql” in the current directory.

But before running the command, we have to navigate to the root directory of our Drupal installation.

Furthermore, Drush has to be installed and properly configured on our system in order for this command to work.

Alternatively, we can achieve the same goal with the drush archive-dump command.

drush archive-dump default
--tar-options="-z --exclude=sites/default/files"
--destination=/_`date +%F`.tar.gz

When we run this command, it gives us a copy of the database as well as the files folder of our Drupal installation at the destination specified. In case we do not mention a destination folder, the backups can be located at drush-backup in the home folder under the current day’s date.

Furthermore, this command offers the following options as well:

  • –description

    This option gives us a description of the contents we have backed up.

  • –no-core

    It lets us avoid Drupal core files while backing up.

  • –tar-options

    It is the folder that is to be zipped.

  • –overwrite

    This option overwrites the existing backup file.

  • –destination

    It is the path of the file copy.

  • –tags

    It lets us tag the contents to the most relevant tags.

Let us know in the comments which command helped you back up your database successfully in Drush.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

To conclude, our Support Techs demonstrated how to take the backup of the database in Drush via two different commands.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.