-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drush sql-connect Unable to load class Drush\Sql\Sql #2721
Comments
Add --debug and you will see the actual shell commands that are run. See if those fail and fix if needed. |
Thank you, Moshe, for your prompt reply. So ... drush up --debug
and drush sql-cli --debug
and drush sql-connect --debug
|
Solved by adding
to the drush command. Thanks all :) |
drush sql-dump --root=c:/mysites/htdocs/mylocalsite/ worked fine, thanks for the hint |
I encountered this error while migrating a Acquia Dev Desktop build into an AWS environment using a Bitnami AMI. Similar to how DevDesktop pulls the settings['default']['default'] mysql configuration from:
I enabled a similar strategy by pulling the path to the settings directory (which is the home directory) directly into the settings.php file via php require(). $_SERVER['BITNAMI_DRUPAL_SETTINGS_DIR'] would dynamically pull in the proper settings in my Apache2 vhosts_httpd.config files:
Some how drush still won't recognize the settings using drush sql commands ... even though other commands such as drush archive-dump work correctly. I couldn't discover why drush does this, but the solution was simply to remove the require() and have the database settings in the settings.php file. |
@n8thanael the issue (for me anyway, when trying to run Drush on local dev sites) is that Acquia's conditional only runs when serving web pages, not via the Drush CLI, because when you use the CLI, You can work around it by adding this line outside (above) the
(That's an example for macOS users.) It's enough to trick the rest of Dev Desktop's code into looking in the correct place without having to rewrite or duplicate it. |
Ubuntu 16.04 localhost Drush 8.1.10 installed via composer as per the recommended route. Drupal 8.3
Drush runs and completes some tasks. eg
drush status
However when I try any mysql/database-related commands I get errors
Usually like;
drush up
Or this one;
drush sql-connect
Unable to load class Drush\Sql\Sql [error]
Drush\Sql\SqlException: Unable to find a matching SQL Class. Drush cannot find your database connection details. in /home/rich/vendor/drush/drush/commands/sql/sql.drush.inc:541 [error]
Stack trace:
#0 /home/rich/vendor/drush/drush/commands/sql/sql.drush.inc(221): drush_sql_get_class()
#1 /home/rich/vendor/drush/drush/includes/command.inc(422): drush_sql_connect()
#2 /home/rich/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#3 /home/rich/vendor/drush/drush/includes/command.inc(199): drush_command()
#4 /home/rich/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#5 /home/rich/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#6 /home/rich/vendor/drush/drush/drush.php(12): drush_main()
#7 {main}
My settings.php
PATH in .bashrc
Seems correct to me ...?
I have tried Forcing 127.0.0.1 instead of localhost.
I am running drush from drupal root directory.
I would greatly appreciate any suggestions as to where to go next with this. :)
Thanks for looking.
The text was updated successfully, but these errors were encountered: