When creating a database connection in 'app/Console/Kernel.php' and running '
php artisan schedule:run' from CLI the following error occurred:
This can be solved by adding the location to the MySQL socket in the database configuration file 'config/database.php':
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
It is also possible that the connection has failed at host 127.0.0.1, try localhost instead:
'host' => 'localhost'