walid mahmoud

23 Feb 2022

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, ?, //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

23 Feb 2022

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

Replies

walid mahmoud

23 Feb 2022

Thanks 
It's not worked for me.

 

Yasen Sayed

23 Feb 2022

Maybe you have a problem with your environment.

Please check the MYSQL service is working or not.

walid mahmoud

23 Feb 2022

MySQL service is working

© 2024 Copyrights reserved for web-brackets.com