Illuminate\Database\QueryException SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from `sessions` where `id` = bxUWz6kVlzmt1YiaGtcTVuWqFH6OP9yk4p0dgdb8 limit 1) code example

Example: Illuminate\Database\QueryException : SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

$ sudo mysql -u root -p
Now you can add a new MySQL user with the username of your choice.

mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
And finally grant superuser privileges to the user you just created.

mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

after that go and edit .env DB_USERNAME=newuser
DB_PASSWORD=password

Tags:

Sql Example