1

I'm having an issue that is baffling to me as a new user and I'm hoping someone here can answer me how to fix the error. I'm trying to clone an existing drupal installation into a place on my mac with the commands

echo "Pushing private files"
/usr/local/bin/drush core-rsync @hpc.dev:%private @hpc.local:%private
echo "Pushing webroot files"
/usr/local/bin/drush -y core-rsync @hpc.dev @hpc.local
echo "Pushing database"
/usr/local/bin/drush -y sql-sync --no-cache @hpc.dev @hpc.local
echo "Clearing Drupal cache"
/usr/local/bin/drush -y @hpc.local cc all

This works fine until with the sql-sync piece, where I get the error:

... stuff stuff stuff
Command dispatch complete                                                             [notice]
Copying dump file from Source to Destination.                                      [ok]
Starting to import dump file onto Destination database.                            [ok]
/usr/bin/php /usr/local/drush-master/drush.php --php=/usr/bin/php  --backend=2        [notice]
--verbose --yes --strict=0 --root=/Users/cook47/Sites/drupal-test/html
--uri='http://localhost/~cook47/drupal-test'  sql-query  
--file=/tmp/hpc-drupal-dev_20160302_005939.sql.gz --file-delete 2>&1
exception 'Drush\Sql\SqlException' with message 'Unable to find a matching SQL     [error]
Class. Drush cannot find your database connection details.' in
/usr/local/drush-master/commands/sql/sql.drush.inc:591
Stack trace:
#0 /usr/local/drush-master/commands/sql/sql.drush.inc(419):
drush_sql_get_class(NULL)
#1 [internal function]: drush_sql_query()
#2 /usr/local/drush-master/includes/command.inc(366):
call_user_func_array('drush_sql_query', Array)
#3 /usr/local/drush-master/includes/command.inc(217): _drush_invoke_hooks(Array,
Array)
#4 [internal function]: drush_command()
#5 /usr/local/drush-master/includes/command.inc(185):
call_user_func_array('drush_command', Array)
#6 /usr/local/drush-master/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#7 /usr/local/drush-master/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /usr/local/drush-master/drush.php(12): drush_main()
#9 {main}

Something appears to be awry with my database on the localhost or perhaps with my alias.

Here is my alias for localhost:

$aliases['local'] = array (
  'root' => '/Users/cook47/Sites/drupal-test/html', //CHANGEME
  'uri' => 'http://localhost/~cook47/drupal-test', //CHANGEME
  //'remote-host' => "localhost",
  //'remote-user' => 'cook47',
  'path-aliases' => array (
    '%drush' => '/usr/local/bin/drush', //CHANGEME
    '%site' => 'sites/default/',
    '%files' => 'sites/default/files',
    '%private' => '../private',
    '%dump' => '/export/www/hpc-drupal-dev.llnl.gov/drush-dump.sql',//CHANGEME
  ),
  'target-command-specific' => array(
    'sql-sync' => array(//CHANGEME
      'enable' => array('devel'),
      'disable' => array(
      ),
    ),
  ),
  'command-specific' => array(
    'rsync' => array(
      'mode' => 'vrlzOk',
      'exclude-conf' => 1,
    ),
  ),
  'databases' => array (
    'default' => array (
      'default' => array (
        'database' => 'hpc-drupal-dev', //CHANGEME
        'username' => 'hpc-drupal-dev', //CHANGEME
        'password' => 'xxxxxx', //CHANGEME
        'host' => 'localhost',
        'port' => '',
        'driver' => 'mysql',
        'prefix' => '',
      ),
    ),
  ),
);

1 Answer 1

2

Drush no longer allows you to define a 'database' record in your site alias file for use with sql-sync. This used to work in earlier versions, but is no longer supported. Make sure that the source and target sites both have valid settings.php files that include the database information.

To test:

drush @hpc.dev sql-conf

If your database connection is correct, it will be displayed. Using sql-conf on each site can help isolate which one is having a problem with its connection info.

2
  • That fixes the error I'm reporting in my question, so I've marked it as the answer. I have a followup, though, which I will post as a separate question.
    – Rich
    Mar 2, 2016 at 17:52
  • The new problem is posted here: drupal.stackexchange.com/questions/193296/…
    – Rich
    Mar 2, 2016 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.