close

[Solved] SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO) . DB_HOST set to localhost

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO) . DB_HOST set to 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 SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO) . DB_HOST set to localhost Error Occurs?

Today I get the following error SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO) . DB_HOST set to localhost in php.

How To Solve SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO) . DB_HOST set to localhost Error ?

  1. How To Solve SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) . DB_HOST set to localhost Error ?

    To Solve SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) . DB_HOST set to localhost Error The problem is that the project made a cache file 'config.php' must be deleted in order to allow the system to restart and you can do so by accessing this file and deleting it

  2. SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) . DB_HOST set to localhost

    To Solve SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) . DB_HOST set to localhost Error The problem is that the project made a cache file 'config.php' must be deleted in order to allow the system to restart and you can do so by accessing this file and deleting it

Solution 1

Make sure your DB credential and DB Host is set correctly :

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE="your_database_name"
DB_USERNAME="put_db_user_name _here"
DB_PASSWORD="put_db_password_here_if_have_set"

If you have not set any db password the put

DB_PASSWORD=""

Solution 2

The problem is that the project made a cache file ‘config.php’ must be deleted in order to allow the system to restart and you can do so by accessing this file and deleting it

bootstrap/cache/config.php

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