DEV Community

Tutsmake
Tutsmake

Posted on

Laravel sqlstate(hy000 error 1045) access denied for user

Laravel sqlstate(hy000 error 1045) access denied for user

The Laravel error SQLSTATE[HY000] Access denied for user can occur if you forgot to add the database name, username, and password to your Laravel app. You can fix this by opening the .env file in the Laravel app and adding the database name, username, and password.

The error can also occur if:

  • The password you are using doesn't match what MySQL thinks the password should be for the user you're connecting as.
  • A matching MySQL user doesn't exist.
  • The user “root” does not have the necessary permissions.
  • If you are using the PHP's default web server, you need to restart your server after changing your .env file values.

Read More Laravel sqlstate(hy000 error 1045) access denied for user

Top comments (0)