This might be repeated question. But I had no luck with previous answers
I just git clone a laravel project. Now I tried to do php artisan migrate
git clone
php artisan migrate
I had the same problem, turns out the .env that shipped with the framework defaulted the DB_HOST to localhost and had DB_PORT set.
.env
DB_HOST
localhost
Changed the host to the FQDN of the machine and it worked fine. I'm guessingif you're connecting to localhost it expects a socket and not a port.