I'm using Laravel 5 and when I am running php artisan route:list
, it always gives me an error of SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES). This shouldn't be because my application will not be connecting to any database since it will be a static website.
I tried removing the variables on the .env file:
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Just still gives me errors. It seems like it is still connecting to the database wherein it shouldn't make any database connection.
I was experiencing the same issues when I upgraded my Laravel installer from v1.1 to v1.2.
It appears that the routes.php file by default is adding the Authentication route:
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
This causes to display an error message to what you were describing:
$ php artisan route:list
[PDOException]
SQLSTATE[28000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)
I resolved this by removing the scaffolding included within Laravel by executing the following command:
$ php artisan fresh
Or by simply deleting the Auth route within the file itself.
You should now be able to run: php artisan route:list
Hope this helps!
This might be the problem of localhost. Do check your WAMP, MAMP, LAMP and XAMP MySql server if you are using any of them.
This have solve my problem:
It looks like artisan might be working in the wrong environment. Run "php artisan tinker
", then "App::environment();
" to see which environment Artisan is running in. If it is something other than production, you need to create a folder with that environments name within your app/config folder, and put a copy of the "database.php" file in it.
After That if you are not doing any DB related task it will not access DB.
I found answer here
Alternatively You can run following command to resolve this issue:
php artisan migrate:install --env="local"
After this run you command:
php artisan route:list
Enjoy.