After new laravel8 jetstream with livewire fresh installed when I run the command php artisan migrate then it gives the error on my terminal
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (SQL: select * from information_schema.tables where table_schema = lweb and table_name = migrations and table_type = 'BASE TABLE')
at C:\xampp\htdocs\liveweb\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▕
1 C:\xampp\htdocs\liveweb\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known. ")
2 C:\xampp\htdocs\liveweb\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=mysql;port=3306;dbname=lweb", "root", "", [])
PS C:\xampp\htdocs\liveweb>
DB_HOST
entry in your .env file andconfig/database.php
for the database you are using, both places the value should be 127.0.0.1 if the database server is also running on the same machine as the webserverPDO::__construct("mysql:host=mysql;port=3306;dbname=lweb", "root", "", [])
in the error shows that you haveDB_HOST=mysql
in .env file which can't be resolved to a host address - host means the ip address of the server hosting the database