Base table or view already exist error in Laravel migration

97 Views Asked by At

I am following the instructions at https://jetstream.laravel.com/installation.html for installing Laravel Jetstream.

I ran artisan jetstream:install and choose to install with Livewire support, API support, email verification and PHPUnit support.

I then installed frontend assets and set up Laravel Sail. Then I ran the following:

sail artisan db:wipe

... and got this encouraging output:

INFO  Dropped all tables successfully.

... but when I do sail artisan migrate I see this output:

   INFO  Preparing database.  

  Creating migration table ............................................................................. 24ms DONE

   INFO  Running migrations.  

  2014_10_12_000000_create_users_table ................................................................. 22ms DONE
  2014_10_12_100000_create_password_reset_tokens_table ................................................. 27ms DONE
  2014_10_12_200000_add_two_factor_columns_to_users_table ............................................... 9ms DONE
  2019_08_19_000000_create_failed_jobs_table ........................................................... 20ms DONE
  2019_12_14_000001_create_personal_access_tokens_table ................................................ 40ms DONE
  2023_08_30_094442_create_sessions_table .............................................................. 46ms DONE
  2023_08_30_094639_create_sessions_table ............................................................... 1ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sessions' already exists (Connection: mysql, SQL: create table `sessions` (`id` varchar(255) not null, `user_id` bigint unsigned null, `ip_address` varchar(45) null, `user_agent` text null, `payload` longtext not null, `last_activity` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:801
    797▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    798▕                 );
    799▕             }
    800▕ 
  ➜ 801▕             throw new QueryException(
    802▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    803▕             );
    804▕         }
    805▕     }

      +9 vendor frames 

  10  database/migrations/2023_08_30_094639_create_sessions_table.php:14
      Illuminate\Support\Facades\Facade::__callStatic()
      +24 vendor frames 

  35  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

Uh oh! Anybody know what I'm doing wrong?

(As I said, this is a fresh installation. I haven't touched anything in my IDE yet.)

0

There are 0 best solutions below