Posts Learn Components Snippets Categories Tags Tools new About
/

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

Learn how to solve the access denied error for homestead users at localhost for local Laravel development using an easy method

Created on Nov 08, 2021

10 views

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.

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

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components
)