Home / Snippets / Solving Laravel Access denied for user 'homestead'@'localhost' the Easy Way
Solving Laravel Access denied for user 'homestead'@'localhost' the Easy Way cover

Solving Laravel Access denied for user 'homestead'@'localhost' the Easy Way

613

3 years ago

0 comments

Sometimes you might come across an "access denied" error when starting a new Laravel development and to solve this problem you can make use of the following easy steps.

Step 1: Update .env file DB Credentails


The 1st step is to update the environment file and DB credentials located inside the ".env" file. Do note that the setting will be depending on your database provider "MySQL" or "PostgreSQL" and etc.
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=
DB_USERNAME=postgres
DB_PASSWORD=

Step 2: Clear Cache


Once you have updated the DB_ values you need to clear the cache so that Larave read the new updated environment files.
php artisan config:clear

Step 3: Restart Server


If you are using a Local server then you can restart and rerun "php artisan serve" once again.
php artisan serve
Otherwise, if you are using Valet or Homestead do restart it manually using the available commands.
valet restart
Laravel Homestead restarts command.
vagrant reload --provision
Lastly, if you are using WAMP / XAMPP / MAMP do use the GUI start and stop button to restart it.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this