I'm using a Vagrant environment generated from https://puphpet.com/ for a Drupal project & it is all going well except for Drush which gives me an error any time I try running "drush cc -all", see the error below.
<h1>Additional uncaught exception thrown while handling exception.</h1><h2>Original</h2><p>PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected: SELECT 1 FROM {blocked_ips} WHERE ip = :ip; Array
(
[:ip] =&gt; 127.0.0.1
)
in drupal_is_denied() (line 1933 of /var/www/includes/bootstrap.inc).</p><h2>Additional</h2><p>PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected: SELECT * FROM {system} WHERE type = &#039;theme&#039; OR (type = &#039;module&#039; AND status = 1) ORDER BY weight ASC, name ASC; Array
(
)
in system_list() (line 165 of /var/www/includes/module.inc).</p><hr />Drush command terminated abnormally due to an unrecoverable error. [error]
From what I gather the problem is that it isn't selecting a database. Does anyone know where the details for this would be stored? The Drupal site itself is connecting & using the database fine.
I'm not sure if this would cause and issue but the database details for the Drupal site are stored as an Apache environmental variable.
drush -r /var/www/html status
(or-r /var/www
in your case) and see if that gives you anything meaning ful.