After installing Drupal 8 (via installation wizard), trying to run any drush command, getting below error:

drush en views_ui
PDOException: SQLSTATE[HY000] [2002] No such file or directory in core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 79 Drush command terminated abnormally due to an unrecoverable error.

Drupal version: 8.2.x

Drush version: 8.1-dev


Make sure your database host setting is instead of localhost.

| improve this answer | |
  • 1
    This is a DB connection issue. I faced this while DB server was down. Before replacing 'localhost', better check your DB connection is working – augusto Oct 5 '18 at 9:05
  • Also, it is worth to check file permissions since I didn't check the symlink I had used and the original file used r-xr-xr-x (555). Changed to 755 and this error was fixed. Would be nice if a better, more specific error would be logged by Drupal. – Gugols May 20 '19 at 22:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.