Skip to content
Advertisement

(“SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO)”)

I tried deploying my project to an AWS EC2 server but when I tried to run php artisan migrate I am getting the following error.

PDOException::(“SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO)”)

PDO::__construct(“mysql:host=127.0.0.1;port=3306;dbname=myDb”, “root”, “”, [])

The following is my .env file:

JavaScript

Advertisement

Answer

Okay, so I got it fixed. All I did was run php artisan config:clear. The problem was I had a previous migration already done with wrong credentials and everything. So after running php artisan config:clear I went ahead and ran php artisan migrate and everything was fine.

Thanks all for your time.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement