Bluehost Website Hosting

How to Back Up Your Drupal Database

How to Back Up Your Drupal Database
Posted on 23 July 2012. Tags: backup drupal database, drupal, mysql

You’re probably wondering what’s so important about the database. Well, this is where Drupal stores your site’s content, login information, and configuration. By having a backup of your database, you’re ensuring that you can set up development or testing copies of your website, recover from server problems, and move your entire site to different machine. 

The database is actually just one out of two aspects of your website. You also need to have a backup of your website files. Whatever method below you choose for backing up your database, make sure that you test the entire process of backing up and restoring your website in a development environment before relying on it and using it for your live site. 

Method #1: Tools from Your Hosting Provider 

If your Drupal site is hosted by a web hosting provider, then they may provide you with a “wizard”, backup services, or control panel option to back up your databases manually or automatically. Even if your database backups are done automatically, it’s a good idea to do your own in the even that your hosting provider is unable to recover it.

Method #2: MySQL GUI Tools

If you have root access to your MySQL database, then you can use MySQL Workbench, a freeware open-source utility for database backup, recovery, and administration. 

Method #3: Backup from the Command Line

Use the mysqldump program to back up your Drupal database from the command line. Enter the following command to create a backup of the tables in a particular database then save them to a file called “mybackup.sql”:

mysqldump –u [mysql username] –p [nameofdatabase] > mybackup.sql

Since you’ll have to store your backup file in a safe location outside the server, it would be helpful to compress it:

gzip mybackup.sql

Now, you can store mybackup.sql.tgz in another location using SCP or FTP. 

You can actually combine the three steps above and enter the following in the command line:

mysqldump –u [database_username] –p [nameofdatabase] |
gzip > mybackup.sql.gz 

On top of the three methods above, you may use contributed Drupal modules and commercial projects to assist you in backing up your database.

Leave a Reply

 

 

 

Top 5 Web Hosting Companies

Popular Latest Comments Subscribe
  • jayendra: Thanks to share this. I will check these modules into my site.
  • Borhan: Hi there, I am a beginner php and joomla user. I have installed jumi component in joomla 2.5. I want to...
  • Alan Dorthmount: As good as vBadvanced is, theres vBCMS which comes with vBulletin Suite and for those that want...
  • Ahmed: i want to add like button for every page on my website not only for the main URL the code you mentioned needs...
  • ondrej: very nice! godaddy is really slow, I will go for hostgator…

homenewsarticlestutorialsweb hosting reviewsaboutprivacycontactdisclosurefollow us on facebookfollow us on twitter