user image

walid mahmoud
Published in : 2022-02-23

Laravel install passport have access denied error

Laravel

 I tried to install a passport package to my project 

 Illuminate\Database\QueryException  : SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: insert into `oauth_clients` (`user_id`, `name`, `secret`, `provider`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `updated_at`, `created_at`) values (?, Laravel Starter Personal Access Client, qQ12R2oPeJ2Mrlp0sz4kxW1oVyYHklYp9fwPaUAw, ?, http://localhost, 1, 0, 0, 2022-02-23 10:33:52, 2022-02-23 10:33:52))

  at /home/walid/work/training/laravel-adminpanel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673| 

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'")
      /home/walid/work/training/laravel-adminpanel/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31

  2   PDOException::("SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'")
      /home/walid/work/training/laravel-adminpanel/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27

  Please use the argument -v to see more details.

how can I solve this issue?

Comments

Yasen Sayed Date : 2022-02-23

Best answers

8

Best answers

8

Please try these approaches.

Set the database info in your env file like this.

DB_USERNAME=root
DB_PASSWORD=

Clear your project cache with these commands.

php artisan config:cache
php artisan config:clear
php artisan cache:clear

walid mahmoud Date : 2022-02-23

Thanks 
It's not worked for me.

 

Yasen Sayed Date : 2022-02-23

Maybe you have a problem with your environment.

Please check the MYSQL service is working or not.

walid mahmoud Date : 2022-02-23

MySQL service is working

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

[solved] SQLSTATE[42000]: Syntax error or access violation
Publish date: 2022-01-20 | Comments: 2
[SOLVED] No application encryption key has been specified.
Publish date: 2021-05-17 | Comments: 2
call_user_func() expects parameter 1 to be a valid callback
Publish date: 2022-02-22 | Comments: 2