You say that Drupal works fine. Do you really mean that your Drupal 9.2.1 website is fully functional without a database connection? That is surprising!
You can start by connecting to this environment via ssh
and testing a connection to the database using the command-line mysql
utility and the database authentication credentials stored in your settings.php
file.
If you get a successful connection, run some diagnostic commands like USE `drupal`;
(replacing drupal
with the DB name specified in your settings) and SHOW TABLES;
and SELECT COUNT(*) FROM `node`;
(just be very careful not to issue any commands that insert, update, or delete any data!)
If Drupal really can connect to the database, and you can connect in this way from the command line, then you will have narrowed the problem down to Drush.
You can make sure that you are really running the correct project-local version of Drush 10 that you installed with Composer by executing which drush
at the command prompt to see if you are instead using a gloabally installed Drush, perhaps even a different version.
If that is the case, please specify the full path to your local Drush to be sure you are executing the correct Drush PHAR:
$ cd /home/ip/d916/
$ ./vendor/bin/drush status
$ ./vendor/bin/drush cr
If these commands work for you, then you have different options depending on your hosting. The Drush docs are excellent, and will help you to decide the correct path forward.