skip to Main Content

enter image description here

I’m trying to make a CRUD app on laravel. server is on docker and localhost is on 0.0.0.0

enter image description here

SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select * from `students`)

2

Answers


  1. I think the problem lies within the model that you are try to calling. Check if you have created the Student model in app folder of your project.

    if it is not there follow the guide to create and calling model through:
    https://laravel.com/docs/10.x/eloquent

    Login or Signup to reply.
  2. change
    From

    DB_HOST=localhost
    

    To

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