I use Mamp and have issues if I don't set it up appropriately.
if database server is at 'localhost' then the PDO drivers try to use Unix Sockets
if the server is '127.0.0.1' then it uses TCPIP
You can add a port number to the DB config. For Mamp (and I can't remember if this is the default) but the port number is 8889
This works for me with MAMP
.env
DB_HOST=127.0.0.1
DB_PORT=8889
DB_DATABASE=myproject
DB_USERNAME=root
DB_PASSWORD=root
config\database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],