---
title: "Backing up your Drupal database"
date: "2022-01-31T19:33:31+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/92601-backing-your-drupal-database"
id: "000eeb2d-e9c3-4a32-95f5-8f25226da271"
---

**Note**

For information about backing up your Acquia Cloud hosted website's database, see [Backing up your application](/node/56287).

Drupal stores the content of your website, configuration, and log information in the database. Keeping backups of the database ensures that you can recover from server disasters, easily set up testing or development copies of your website, or move your website to another environment. The best practice for you depends on the specifics of your installation and what tools you're comfortable using.

**Important**

_Backing up your website's database does not back up your website's files._

To be able to completely restore your website from a backup, you must also separately [back up your website's files](https://support.acquia.com/hc/en-us/articles/360005226493-Backing-up-your-Drupal-file-system).

Whatever backup method you choose, test making a backup and restoring your website from it in a test environment before relying on it as a backup strategy for a production website.

Several database backup methods are available for your use, including the following:

*   **Backup tools provided by your hosting provider**
    
    If you host your Drupal website with a hosting provider, they may have a service that backs up your databases. Even if these backups are handled automatically, it's good practice to ensure that you know when and how they're backed up.
    
    For information about backing up your databases in Acquia Cloud, see [Backing up your application](/node/56287).
    
*   **MySQL Workbench**
    
    If you have direct access to your MySQL database, MySQL offers a free open-source utility package called [MySQL Workbench](http://dev.mysql.com/downloads/workbench/) that allows you to administer, backup, and recover databases.
    
*   **Command-line tools**
    
    To back up your website's database using command-line tools:
    
    1.  Open a command prompt window.
    2.  Use the following `mysqldump` command to back up all of the tables in a specific database, and then save them to a file named `backup.sql` (where `[mysql_user]` is your MySQL username, and `[database]` is the database that you want to back up):
        
            mysqldump -u [mysql_user] -p [database] > backup.sql
        
        Alternatively, you can export specific tables like so
        
            mysqldump -u [mysql_user] -p [database] [table1] [table2] > backup.sql
        
          
          
        Note
        
    3.  The `mysqldump` command in the previous code snippet asks for and requires your database user password.
        
    4.  Optionally, you can compress the database backup file to make the file easier to backup and store. To do this, use the following command:
        
            gzip backup.sql
        
        Note
        
        You can combine the backup and compression steps in this procedure by using the following command:
        
            mysqldump -u [database_username] -p [databasename] | gzip > backup.sql.gz
        
    5.  Using FTP or SCP, copy the database backup file (or the compressed backup file if you completed the previous step) to a safe location.