I installed PHP 7.4.21. Then I installed, then Drupal 9.2.1, and Drush 10.5.0 with Composer on Ubuntu 18.04 as well. 10drush is an alias to the 10.5.0 version.
1st check: 10drush -> enter =>Running Drush without arguments, I gotget the drush overviewlist of all the available commands. means drush works.
Then I ran drush cr and got
Running drush cr
gives me the following error:.
'The specified database connection is not defined: default'
The specified database connection is not defined: default
After that I trieddrush cr --root=/home/ip/d916/web
gives the same command in addition witherror.
10drush cr --root=/home/ip/d916/web
Same error. The output of '10drush cr -vvv':
Exception trace:
at /home/ip/d916/web/core/lib/Drupal/Core/Database/Database.php:371
Drupal\Core\Database\Database::openConnection() at /home/ip/d916/web/core/lib/Drupal/Core/Database/Database.php:169
Drupal\Core\Database\Database::getConnection() at n/a:n/a
call_user_func_array() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:258
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:437
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:240
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php:89
Drupal\Core\Cache\ChainedFastBackendFactory->get() at /home/ip/d916/web/core/lib/Drupal/Core/Cache/CacheFactory.php:83
Drupal\Core\Cache\CacheFactory->get() at n/a:n/a
call_user_func_array() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:258
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:437
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:240
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Core/DrupalKernel.php:586
Drupal\Core\DrupalKernel->preHandle() at /home/ip/d916/web/core/includes/utility.inc:35
drupal_rebuild() at /home/ip/d916/vendor/drush/drush/src/Commands/core/CacheCommands.php:234
Drush\Commands\core\CacheCommands->rebuild() at n/a:n/a
call_user_func_array() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
Consolidation\AnnotatedCommand\CommandProcessor->process() at /home/ip/d916/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:311
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /home/ip/d916/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /home/ip/d916/vendor/symfony/console/Application.php:1027
Symfony\Component\Console\Application->doRunCommand() at /home/ip/d916/vendor/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /home/ip/d916/vendor/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /home/ip/d916/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at /home/ip/d916/vendor/drush/drush/src/Runtime/Runtime.php:48
Drush\Runtime\Runtime->run() at /home/ip/d916/vendor/drush/drush/drushdrush cr -vvv
is the following.php:72
require() at /home/ip/d916/vendor/drush/drush/drush:4
Exception trace
at /home/ip/d916/web/core/lib/Drupal/Core/Database/Database.php:371
Drupal\Core\Database\Database::openConnection() at /home/ip/d916/web/core/lib/Drupal/Core/Database/Database.php:169
Drupal\Core\Database\Database::getConnection() at n/a:n/a
call_user_func_array() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:258
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:437
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:240
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php:89
Drupal\Core\Cache\ChainedFastBackendFactory->get() at /home/ip/d916/web/core/lib/Drupal/Core/Cache/CacheFactory.php:83
Drupal\Core\Cache\CacheFactory->get() at n/a:n/a
call_user_func_array() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:258
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:437
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:240
Drupal\Component\DependencyInjection\Container->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
Drupal\Component\DependencyInjection\Container->get() at /home/ip/d916/web/core/lib/Drupal/Core/DrupalKernel.php:586
Drupal\Core\DrupalKernel->preHandle() at /home/ip/d916/web/core/includes/utility.inc:35
drupal_rebuild() at /home/ip/d916/vendor/drush/drush/src/Commands/core/CacheCommands.php:234
Drush\Commands\core\CacheCommands->rebuild() at n/a:n/a
call_user_func_array() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
Consolidation\AnnotatedCommand\CommandProcessor->process() at /home/ip/d916/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:311
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /home/ip/d916/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /home/ip/d916/vendor/symfony/console/Application.php:1027
Symfony\Component\Console\Application->doRunCommand() at /home/ip/d916/vendor/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /home/ip/d916/vendor/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /home/ip/d916/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at /home/ip/d916/vendor/drush/drush/src/Runtime/Runtime.php:48
Drush\Runtime\Runtime->run() at /home/ip/d916/vendor/drush/drush/drush.php:72
require() at /home/ip/d916/vendor/drush/drush/drush:4
Composer works without any mistake. Drupal work fine too. Unfortunately I can't work without drushDrush 10.
How can I fix the The specified database connection is not defined: default error?