2

I'm studying Laravel 8 and I'm a beginner. I tried installing it via Sail to take advantage of Docker. Terminal:

curl -s "https://laravel.build/learnlaravel" | bash
cd learnlaravel
./vendor/bin/sail up

Now going to localhost I see the Laravel welcome page, everything ok.

if I do:

php artisan migrate

I get this error:

xlf @ MBP16-XLF learnlaravel% php artisan migrate

   Illuminate \ Database \ QueryException

  SQLSTATE [HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = learnlaravel and table_name = migrations and table_type = 'BASE TABLE')

  at vendor / laravel / framework / src / Illuminate / Database / Connection.php: 678
    674▕ // If an exception occurs when attempting to run a query, we'll format the error
    675▕ // message to include the bindings with SQL, which will make this exception a
    676▕ // lot more helpful to the developer instead of just the database's errors.
    677▕ catch (Exception $ e) {
  ➜ 678▕ throw new QueryException (
    679▕ $ query, $ this-> prepareBindings ($ bindings), $ e
    680▕);
    681▕}
    682▕

can someone kindly explain to me in simple words what i did wrong or what i should do? is mySQL database already on Docker? how do i log in to create and configure it with the credentials of the .env file? thank you for your understanding and support :)

Lorenzo Franzone
  • 143
  • 1
  • 11

1 Answers1

2

Try

./vendor/bin/sail artisan migrate

instead of

php artisan migrate

Docs: https://laravel.com/docs/8.x/artisan#laravel-sail

Additionally you can install any database manager and connect to your database with this credentials to view and configure it.

elleVan
  • 61
  • 4