close

[Solved] php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user ‘laravel’@’localhost’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user ‘laravel’@’localhost’ in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user ‘laravel’@’localhost’ Error Occurs?

Today I get the following error php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user ‘laravel’@’localhost’ in php.

How To Solve php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user ‘laravel’@’localhost’ Error ?

  1. How To Solve php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' Error ?

    To Solve php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' Error In my case it solved with using localhost instead of 127.0.0.1

  2. To Solve php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' Error

    To Solve php artisan migrate – SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' Error In my case it solved with using localhost instead of 127.0.0.1

Solution 1

You don’t have a user named ‘laravel’. You should change the DB_USERNAME to the one you’re actually using to access your DB. Mostly it’s root by default so the changes in .env should be

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

Solution 2

In my case it solved with using localhost instead of 127.0.0.1

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment