drush – How can I fix the “The specified database connection is not defined: default” error?

I installed PHP 7.4.21, then Drupal 9.2.1, and Drush 10.5.0 with Composer as well.

Running Drush without arguments, I get the list of all the available commands.
Running drush cr gives me the following error.

The specified database connection is not defined: default

drush cr --root=/home/ip/d916/web gives the same error.

The output of drush cr -vvv is the following.

Exception trace

at /home/ip/d916/web/core/lib/Drupal/Core/Database/Database.php:371
DrupalCoreDatabaseDatabase::openConnection() at /home/ip/d916/web/core/lib/Drupal/Core/Database/Database.php:169
DrupalCoreDatabaseDatabase::getConnection() at n/a:n/a
call_user_func_array() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:258
DrupalComponentDependencyInjectionContainer->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
DrupalComponentDependencyInjectionContainer->get() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:437
DrupalComponentDependencyInjectionContainer->resolveServicesAndParameters() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:240
DrupalComponentDependencyInjectionContainer->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
DrupalComponentDependencyInjectionContainer->get() at /home/ip/d916/web/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php:89
DrupalCoreCacheChainedFastBackendFactory->get() at /home/ip/d916/web/core/lib/Drupal/Core/Cache/CacheFactory.php:83
DrupalCoreCacheCacheFactory->get() at n/a:n/a
call_user_func_array() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:258
DrupalComponentDependencyInjectionContainer->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
DrupalComponentDependencyInjectionContainer->get() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:437
DrupalComponentDependencyInjectionContainer->resolveServicesAndParameters() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:240
DrupalComponentDependencyInjectionContainer->createService() at /home/ip/d916/web/core/lib/Drupal/Component/DependencyInjection/Container.php:176
DrupalComponentDependencyInjectionContainer->get() at /home/ip/d916/web/core/lib/Drupal/Core/DrupalKernel.php:586
DrupalCoreDrupalKernel->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
DrushCommandscoreCacheCommands->rebuild() at n/a:n/a
call_user_func_array() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
ConsolidationAnnotatedCommandCommandProcessor->runCommandCallback() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
ConsolidationAnnotatedCommandCommandProcessor->validateRunAndAlter() at /home/ip/d916/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
ConsolidationAnnotatedCommandCommandProcessor->process() at /home/ip/d916/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:311
ConsolidationAnnotatedCommandAnnotatedCommand->execute() at /home/ip/d916/vendor/symfony/console/Command/Command.php:255
SymfonyComponentConsoleCommandCommand->run() at /home/ip/d916/vendor/symfony/console/Application.php:1027
SymfonyComponentConsoleApplication->doRunCommand() at /home/ip/d916/vendor/symfony/console/Application.php:273
SymfonyComponentConsoleApplication->doRun() at /home/ip/d916/vendor/symfony/console/Application.php:149
SymfonyComponentConsoleApplication->run() at /home/ip/d916/vendor/drush/drush/src/Runtime/Runtime.php:118
DrushRuntimeRuntime->doRun() at /home/ip/d916/vendor/drush/drush/src/Runtime/Runtime.php:48
DrushRuntimeRuntime->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 Drush 10.

How can I fix the The specified database connection is not defined: default error?