Skip to content
Advertisement

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

I was trying to implement basic user registration & login using ‘auth’. I am able to create the migrations and the tables are already created in the database as well. enter image description here

When I fill up the registration details such as Name, Email, Password & Confirm Password and hit register, I’m landing up in this error:

enter image description here

This is the code in my .env file

JavaScript

I’ve added any other code or have made any other changes except changing the Route web.php as

JavaScript

Please help me where I’ve gone wrong. This is the first application I’m working on after learning laravel basics.

Database.php looks like:

JavaScript

Here is my User.php model:

JavaScript

Advertisement

Answer

One last possibility would be that your server is forcing the value of the env variable DB_PASSWORD ether through Vhost or .htaccess

To verify this, try changing your .env variable to DB_T_PASSWORD=12345678! and dont forget to change it in database.php config file 'password' => env('DB_T_PASSWORD', ''),

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