Laravel homestead database connection error

85 Views Asked by At

I set up my laravel 10 project with vagrant homestead. I run migrations and I see my tables in pgAdmin4.

When I call myproject.test in my browser I get an error:

Illuminate \ Database \ QueryException
PHP 8.2.1
10.24.0

SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "sessions" does not exist LINE 1: select * from "sessions" where "id" = $1 limit 1 ^

select * from "sessions" where "id" = 63wtvidU18U6FDk12BmdhFeZFEtwaBgLmSfTvUkH limit 1

How do I solve that problem? Thank you for your hints!

I've done php artisan optimize:clear set up everything again. But somehow the connection to the homestead database fails.

EDIT:

I changed in my .env file

BROADCAST_DRIVER=redis
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=30

to

CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=30

MEMCACHED_HOST=127.0.0.1

Now I have access to my welcome page. But it does not find the tables anymore when I logged in.

SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "users" does not exist LINE 1: select count(*) as aggregate from "users" where "email" = $1 ^

Why? When I like to migrate it tells me there is nothing to. It means the table users exists.

0

There are 0 best solutions below