Internal Server Error SQLSTATE[42S02]
ednaodetta
FREEOP

a year ago

Internal Server Error

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'railway.sessions' doesn't exist (Connection: mysql, SQL: select * from sessions where id = YcNAPEgBayJzE4UTYLKbpK7eINgiDiAiCAjs3L1r limit 1)

when i created mysql db from railway and changed my .env in my local, i changed the

DB_CONNECTION=mysql
DB_HOST=mysql.railway.internal
DB_PORT=3306
DB_DATABASE=railway
DB_USERNAME=root
DB_PASSWORD=

and now when I php artisan serve in my local only, it shows 

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql.railway.internal failed: No such host is known. (Connection: mysql, SQL: select * from `sessions` where `id` = h2k2gIWDKCAMIxP8esVuUFwNaMGxsJz6lz8W2Zgb limit 1)

what should i do next?
Solved

3 Replies

ashikes
TRIAL

a year ago

Go to settings of your railway mysql under Networking section there will be a url paste that url in your DB_HOST and also change the port


ashikes

Go to settings of your railway mysql under Networking section there will be a url paste that url in your DB_HOST and also change the port

ednaodetta
FREEOP

a year ago

public or private networking?


unicodeveloper
PRO

a year ago

You are getting this error because you have not run any migrations yet for the database on Railway. It can't find the sessions table because no table exists yet in the database.

In this guide, you can see how migrations was setup for the Laravel app. https://docs.railway.com/guides/laravel#set-up-database-migrations-crons-and-workers


Status changed to Awaiting User Response Railway about 1 year ago


Railway
BOT

7 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 7 months ago


Loading...