Answers.Body: <p>One answer to your question is that you can use the sql-dump drush command to dump your civicrm database by using this option:</p>
  
  <pre><code> --database : The DB connection key if using multiple connections in settings.php.
  </code></pre>
  
  <p>For that to work, you'd have to edit your drupal settings file to include something like:</p>
  
  <pre><code>$database['civicrm'] = array('default' =&gt; array('driver' =&gt; .. etc.
  </code></pre>
  
  <p>A second answer is that the civicrm-sql-dump drush command does not use the drupal settings file, but the civicrm settings file, to get the db name and credentials, so the fact you're getting the same dump from both suggests that you might not be using a separate db for civicrm as you think. Maybe you're looking at the wrong civicrm.settings.php file?</p>
  
  <p>It does look like you want to revert to the 6.x drush. I haven't ever seen the behaviour you describe, but I tend to use bash scripts for mysql backups anyway, to keep things simpler.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-05T15:34:54.410Z
Answers.LastActivityDate: 2015-08-05T15:34:54.410Z
Answers.UserDisplayName: Alan Dixon
Answers.Body: <p>Just to submit as an answer rather than comment - I can confirm that I no longer see this behavior on any of my Civi installs, which are running 4.4.19 or 4.6.8.  I saw this a bunch in 4.3 and earlier versions of 4.4, though only with drush, never with wp-cli.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T16:39:03.037Z
Answers.LastActivityDate: 2015-09-04T16:39:03.037Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I've recently made some backup scripts to automate backup of my site and databases. One of the scripts uses drush to dump the drupal and civicrm databases with these commands:</p>
  
  <pre><code>drush @myserveralias cc all &amp;&amp; drush @myserveralias sql-dump --gzip --result-file=mydrupaldatabase-150731.sql
  
  drush @myserveralias cc all &amp;&amp; drush @myserveralias civicrm-sql-dump --gzip --result-file=mycivicrmdatabase-150731.sql
  </code></pre>
  
  <p>My problem is that both of them dumps the drupal database - I would like the second one to dump the civi-database.</p>
  
  <p>Should i somehow specify the civicrm database? My aliases.drushrc.php doesn't specify anything about databases under myserveralis - should it be specified there?
  My settings.php has this to say about databases:</p>
  
  <pre><code>$databases['default']['default'] = array(
  'driver' =&gt; 'mysql',
  'database' =&gt; 'drupal',
  'username' =&gt; 'myusername',
  'password' =&gt; 'mypassword',
  'host' =&gt; 'localhost',
  'port' =&gt; 3306,
  'prefix' =&gt; 'drupal_',
  'collation' =&gt; 'utf8_general_ci',
  );
  $databases['default']['default']['prefix']= array(
    'default' =&gt; 'drupal_',
    'civicrm_acl'                              =&gt; '`civicrm`.',
    'civicrm_acl_cache'                        =&gt; '`civicrm`.',
    'civicrm_acl_contact_cache'                =&gt; '`civicrm`.',
    'civicrm_acl_entity_role'                  =&gt; '`civicrm`.',
    ...
  </code></pre>
  
  <p>Thanks in advance for any help.</p>
  
  <p>EDIT:
  I've updated drush to version 7.0.0, and the call to civicrm-sql-dump now fails with the following error:</p>
  
  <pre><code>PHP Fatal error:  Call to undefined function drush_sql_dump_execute() in /sites/all/modules/civicrm/drupal/drush/civicrm.drush.inc on line 995
  </code></pre>
  
  <p>I guess there's no longer a function in Drush called drush_sql_dump_execute.</p>
  
  <p>SECOND EDIT:
  I've updated to civicrm 4.6.8 and now it works as it should. I didn't get the chance to explore Alan's suggestions, though i know for sure that my civi-database is in a different database than Drupal.
  Thanks for your help and input. If anyone drops by here having this problem, I would recommend upgrading, as Jon says he hasn't seen this error in any of the newer versions of civi, and upgrading solved it for me. Leaving this open for now, if someone actually solves this for civi 4.4 and Drush 6, then they can provide an answer.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-31T14:13:14.073Z
Comments.Text: What databases are defined in your civicrm.settings.php? Can you confirm that you have installed CiviCRM and Drupal in different databases? In some installations they can share a database, just with different table prefixes (which might explain why the same database is coming out twice).
Comments.UserDisplayName: John
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-31T16:32:15.487Z
Comments.Text: Both the Drupal and civi database are defined in civicrm.settings.php, and they are in different databases.
Comments.UserDisplayName: Anders Iversen
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-03T04:47:36.280Z
Comments.Text: Please give your drush and CiviCRM versions?  I've seen this problem, mostly with older versions of drush.
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-03T09:02:08.817Z
Comments.Text: Drush is version 6.6.0 CiviCRM is version 4.4.5
Comments.UserDisplayName: Anders Iversen
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-04T18:40:24.213Z
Comments.Text: Anders - I would update to the latest CiviCRM 4.4LTS version - I've seen that fix this problem in at least one instance.
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <database><backups><drush>
Title: drush civicrm-sql-dump dumps the drupal database - how do I get it to dump the civicrm database?
ThreadText: # drush civicrm-sql-dump dumps the drupal database - how do I get it to dump the civicrm database?
  
  (Asked by: username_0 on 2015-07-31)
  
  I've recently made some backup scripts to automate backup of my site and databases. One of the scripts uses drush to dump the drupal and civicrm databases with these commands:
  drush @myserveralias cc all && drush @myserveralias sql-dump --gzip --result-file=mydrupaldatabase-150731.sql
  
  drush @myserveralias cc all && drush @myserveralias civicrm-sql-dump --gzip --result-file=mycivicrmdatabase-150731.sql
  
  My problem is that both of them dumps the drupal database - I would like the second one to dump the civi-database.
  Should i somehow specify the civicrm database? My aliases.drushrc.php doesn't specify anything about databases under myserveralis - should it be specified there?
  My settings.php has this to say about databases:
  $databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'drupal',
  'username' => 'myusername',
  'password' => 'mypassword',
  'host' => 'localhost',
  'port' => 3306,
  'prefix' => 'drupal_',
  'collation' => 'utf8_general_ci',
  );
  $databases['default']['default']['prefix']= array(
    'default' => 'drupal_',
    'civicrm_acl'                              => '`civicrm`.',
    'civicrm_acl_cache'                        => '`civicrm`.',
    'civicrm_acl_contact_cache'                => '`civicrm`.',
    'civicrm_acl_entity_role'                  => '`civicrm`.',
    ...
  
  Thanks in advance for any help.
  EDIT:
  I've updated drush to version 7.0.0, and the call to civicrm-sql-dump now fails with the following error:
  PHP Fatal error:  Call to undefined function drush_sql_dump_execute() in /sites/all/modules/civicrm/drupal/drush/civicrm.drush.inc on line 995
  
  I guess there's no longer a function in Drush called drush_sql_dump_execute.
  SECOND EDIT:
  I've updated to civicrm 4.6.8 and now it works as it should. I didn't get the chance to explore Alan's suggestions, though i know for sure that my civi-database is in a different database than Drupal.
  Thanks for your help and input. If anyone drops by here having this problem, I would recommend upgrading, as Jon says he hasn't seen this error in any of the newer versions of civi, and upgrading solved it for me. Leaving this open for now, if someone actually solves this for civi 4.4 and Drush 6, then they can provide an answer.
  
  **Tags:** database, backups, drush
  
  > **Comments:**
  > **username_1**: What databases are defined in your civicrm.settings.php? Can you confirm that you have installed CiviCRM and Drupal in different databases? In some installations they can share a database, just with different table prefixes (which might explain why the same database is coming out twice).  
  > **username_0**: Both the Drupal and civi database are defined in civicrm.settings.php, and they are in different databases.  
  > **username_2**: Please give your drush and CiviCRM versions?  I've seen this problem, mostly with older versions of drush.  
  > **username_0**: Drush is version 6.6.0 CiviCRM is version 4.4.5  
  > **username_2**: Anders - I would update to the latest CiviCRM 4.4LTS version - I've seen that fix this problem in at least one instance.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2015-08-05. Score: 3
  
  One answer to your question is that you can use the sql-dump drush command to dump your civicrm database by using this option:
   --database : The DB connection key if using multiple connections in settings.php.
  
  For that to work, you'd have to edit your drupal settings file to include something like:
  $database['civicrm'] = array('default' => array('driver' => .. etc.
  
  A second answer is that the civicrm-sql-dump drush command does not use the drupal settings file, but the civicrm settings file, to get the db name and credentials, so the fact you're getting the same dump from both suggests that you might not be using a separate db for civicrm as you think. Maybe you're looking at the wrong civicrm.settings.php file?
  It does look like you want to revert to the 6.x drush. I haven't ever seen the behaviour you describe, but I tend to use bash scripts for mysql backups anyway, to keep things simpler.
  
  
  ---
  
  ### Answer by username_2 on 2015-09-04. Score: 1
  
  Just to submit as an answer rather than comment - I can confirm that I no longer see this behavior on any of my Civi installs, which are running 4.4.19 or 4.6.8. I saw this a bunch in 4.3 and earlier versions of 4.4, though only with drush, never with wp-cli.
  
  
  ---
  
  