Home ›
Use Drush to sync the database from one site to anotherUse Drush to sync the database from one site to another
Submitted by Benjamin Melançon on January 20, 2011 - 8:33pm
Based on Greg Anderson's chapter in the Definitive Guide to Drupal 7.
drush sql-sync @dgd7.prod @dgd7.local
Prerequisites
A dgd7.aliases.drushrc.php file in a ~/.drush directory (that's a .drush folder in your home directory) that contains something like:
<?php
$aliases['prod'] = array(
'remote-host' => 'sojourner.mayfirst.org',
'remote-user' => 'definitivedrupal',
'root' => '/var/local/drupal/dgd7/drupal',
'uri' => 'definitivedrupal.org',
);
$aliases['test'] = array(
'remote-host' => 'simone.mayfirst.org',
'remote-user' => 'ben',
'root' => '/var/local/drupal/dgd7/drupal',
'uri' => 'dgd7.agariclabs.org',
);
$aliases['local'] = array(
'root' => '/home/ben/code/dgd7/drupal',
'uri' => 'dgd7.localhost',
);
?>
Note: The first time you do this, if you don't have a database locally already, you'll want to create one, as with drush si
.
You can save a little transfer time by adding --structure-tables-key=common
to the drush sql-sync command.
Searched words:
drush pull down databases
copy a database between drupal sites
Comments
Post new comment