SQLSTATE[HY000] [1045] Access denied for user

Error

[previous exception] [object] (PDOException(code: 1045): SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using
 password: YES) at /opt/lampp/htdocs/wizbrand/wz-account-admin-ms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Co
nnector.php:70)
[stacktrace]


  Do you really wish to run this command? (yes/no) [no]
❯ yes


   Illuminate\Database\QueryException

  SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = wz-account-admin-ms and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
    756▕         // If an exception occurs when attempting to run a query, we'll format the error
    757▕         // message to include the bindings with SQL, which will make this exception a
    758▕         // lot more helpful to the developer instead of just the database's errors.
    759▕         catch (Exception $e) {
  ➜ 760▕             throw new QueryException(
    761▕                 $query, $this->prepareBindings($bindings), $e
    762▕             );
    763▕         }
    764▕     }

      +36 vendor frames
  37  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
[2023-04-01 06:45:36] production.ERROR: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (
SQL: select * from information_schema.tables where table_schema = wz-account-admin-ms and table_name = migrations and table_type
 = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 1045): SQLSTATE[HY000] [1045] Access denied
for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = wz-account-
admin-ms and table_name = migrations and table_type = 'BASE TABLE') at /opt/lampp/htdocs/wizbrand/wz-account-admin-ms/vendor/lar
avel/framework/src/Illuminate/Database/Connection.php:760)
[stacktrace]

Solution

- Try delete next file: bootstap/cache/config.php
- cache and config clear 
- Make sure that user password if you are having "#" then put it in single quote.
0 0 votes
Article Rating
Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Nishant
Nishant
11 months ago

thank you so much this was savior

RJ_99
RJ_99
8 months ago

Awesome. this worked.

2
0
Would love your thoughts, please comment.x
()
x