Debug School

rakesh kumar
rakesh kumar

Posted on

Laravel:Field 'id' doesn't have a default value (SQL: insert into `oauth_clients`

while I, running the command php artisan passport:install
then I face the error

 php artisan passport:install
Encryption keys generated successfully.

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `oauth_clients` (`user_id`, `name`, `secret`, `provider`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `updated_at`, `created_at`) values (?, Laravel Personal Access Client, tNpdTgKzB7Fhc6mSnJI3uFu14dZrwEvuF3DmVKH9, ?, http://localhost, 1, 0, 0, 2023-01-27 06:58:29, 2023-01-27 06:58:29))
Enter fullscreen mode Exit fullscreen mode

Solution:
Method1:

php artisan migrate:refresh
Enter fullscreen mode Exit fullscreen mode

============OR========================
Method2:

step 1: delete all table
step 2: php artisan migrate
step 3: php artisan passport:install

Enter fullscreen mode Exit fullscreen mode

Top comments (0)