June 26, 2012 - Comments Off on Drush de Jour: Painless database backups for your Drupal site

Drush de Jour: Painless database backups for your Drupal site

Proceed directly to drush.
Do not pass Go.
Do not enter your site name.

When you first set up your Drupal site- install drush, the command line shell for Drupal. With drush, you can backup your db, create users, reset passwords, re-index search, start/stop migration, check logs, etc. etc. etc.

From the root of your Drupal install: (e.g., /var/www/<sitename>).

% drush archive-backup --destination=sitebackup.sql

That's it. Your entire drupal database is written to a file.

% drush sql-dump > sitebackup.sql

This method uses drush's Mysql command line interface to do a mysqldump of the site database

And if you want to be stubborn and not install drush:

mysqldump -u -p <sitedatabase> > sitebackup.sql

Links

The Drush de Jour brings you the latest and possibly greatest bits of drush wisdom we use for developing and maintaining our Drupal sites.

Published by: chazcheadle in The Programming Mechanism
Tags: , ,

Comments are closed.