Drush 8.1 Drupal 8 throws PDOException: SQLSTATE[HY000] [2002] on MAMP 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 127.0.0.1 instead of localhost.