I found an answer in this github issue. https://github.com/laravel/framework/issues/2719
The answer is to a) specify the bespoke port number and b) to use 127.0.0.1 instead of localhost so that artisan commands don't try and use local sockets.
My .env file looks like;
DB_HOST=127.0.0.1
DB_PORT=8889
DB_DATABASE=project
DB_USERNAME=root
DB_PASSWORD=root
and my app/config/database.php;
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'), // default port number
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],