Reputation: 1583
Before this project, I could not get this type of error. But at this time, I faced it.
composer require laravel/ui
php artisan ui:auth
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=katherine_cleaners
DB_USERNAME=root
DB_PASSWORD=
After this,
php artisan migrate
Error
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (SQL: select * from information_schema.tables where table_schema = katherine_cleaners and table_name = migrations and table_type = 'BASE TABLE')
at F:\katherine\vendor\laravel\framework\src\Illuminate\Database\Connection.php:678
I tried following php artisan
command: config:clear
, cache:clear
, key:generate
. Also, I change the database name on MySQL and .env. And even, I deleted this project and create a new one. But this doesn't help me.
Does anyone know, how to figure out this error?
Upvotes: 0
Views: 4114
Reputation: 8130
Your host in .env should be pointing to the IP of your database. Assuming your database is residing on the same server as your Laravel application, it should be:
DB_HOST=127.0.0.1
Upvotes: 3