skip to Main Content

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘eshop.sessions’ doesn’t exist
SELECT * FROM sessions WHERE id = N7H5CpGFStKcjjHhlq9aOo05OE0eU2I9muBXC4Tc limit 1

enter image description here

  1. When i check my database i have no table named sessions (never had by the way)
  2. I deleted the foder Migrations, Seeders, Factories and started again but no results
  3. I did all these commandes with no results
    php artisan config:cache
    php artisan config:clear
    and composer dump-autoload -o
    php artisan migrate:fresh –seed
    php artisan migrate

3

Answers


  1. In Laravel 11 you need to have a session table migration for this you can use the artisan comand

    php artisan make:session-table 
    

    After:

    php artisan migrate
    
    Login or Signup to reply.
  2. If you are using Laravel 11 and do not have sessions migration in your create_users_table migration file, you will have to manually add it.
    This is currently the latest migration file for laravel 11.x and inside you can find Schema for missing table

    Login or Signup to reply.
  3. You can replace the session driver in .env file.
    Laravel 11 by default has SESSION_DRIVER=database

    if you don’t want to use this, change it to another driver like
    SESSION_DRIVER=file

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search