phpmysqllaravellaravel-7

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from `permissions`)


I upload my project on C-panel and set my connection for database in my env file, it was ok for me with the same settings, but now i don't know why it's happening, this is error :

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * 
from `permissions`)

And this is my env file settings for database :

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=thermota_db
DB_USERNAME=thermota_user
DB_PASSWORD= { my password }

i don't know this permissions in error, is my permissions_table ?

and why error for this table ?


Solution

  • Multiple reasons can be the cause.

    1. This can happen when the server has already been started before updating database details on your .ENV file.
    2. It could also be from inputting wrong database authentication details.

    Solution

    1. Restart the server anytime you update values on your .ENV file.
    2. Ensure you use the correct authentication details or better still create a new database user.