This question already has an answer here:
I am receiving the following error on my localhost for Laravel 4.1 (using MAMP)
SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (61)
It points to:
/Applications/MAMP/htdocs/crowdsets/laravel-master/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php
This is the function it is pointing to:
public function createConnection($dsn, array $config, array $options) { $username = array_get($config, 'username'); $password = array_get($config, 'password'); return new PDO($dsn, $username, $password, $options); }
Up to this point, I had not received this error.
I have a local environment and production environment set up (the default).
in config/local/database.php I have:
'mysql' => array( 'driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'database', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),