php artisan migrate – error [PDOException] SQLSTATE[HY000] [2002] No such file or directory

php artisan migrate – error [PDOException] SQLSTATE[HY000] [2002] No such file or directory

/Applications/AMPPS/www/blog/config/database.php

I changed the host from localhost into 127.0.0.1 and it worked:

'host' => env('DB_HOST', '127.0.0.1'),