0

When I run the php artisan migrate command, I get the following error:

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = uploadify and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:703
    699▕         // If an exception occurs when attempting to run a query, we'll format the error
    700▕         // message to include the bindings with SQL, which will make this exception a
    701▕         // lot more helpful to the developer instead of just the database's errors.
    702▕         catch (Exception $e) {
  ➜ 703▕             throw new QueryException(
    704▕                 $query, $this->prepareBindings($bindings), $e
    705▕             );
    706▕         }
    707▕     }

      +36 vendor frames 
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

Also, MySQL server is running and I can connect to it using the credentials provided in the .env file. Is this somehow related to Sail? If so, how can I tell my Laravel application to use the local machine environment instead of the Sail?

Farzin
  • 359
  • 1
  • 4
  • 21
  • 1
    Does this answer your question? [PHP error: php\_network\_getaddresses: getaddrinfo failed: (while getting information from other site.)](https://stackoverflow.com/questions/6275535/php-error-php-network-getaddresses-getaddrinfo-failed-while-getting-informat) – Joseph Oct 03 '21 at 09:54

1 Answers1

0

Ok, there was a typo in .env for DB_HOST and I didn't notice it. Changing it back to localhost solved my problem.

Farzin
  • 359
  • 1
  • 4
  • 21