Laravel migration throws "SQLSTATE[HY000] [2002] php_network_getaddresses" exception

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?

1

1 Answer

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like