BlackHole
BlackHole

Reputation: 85

SQLSTATE[HY000] [2002]php_network_getaddresses: getaddrinfo failed: No such host is known

I got this error when I logged in. enter image description here

I tried:

My code:

DB_CONNECTION=mysql
DB_HOST=http://45.77.34.158/phpmyadmin
DB_PORT=3306
DB_DATABASE=dataname
DB_USERNAME=user
DB_PASSWORD=12345679

My server is an online server! Can anybody tell me where I am wrong? I use php7.3.9, laravel 5.7, composer 1.9.1.

Upvotes: 5

Views: 28583

Answers (4)

user14801208
user14801208

Reputation: 39

In .env file change DB_HOST=??????? to DB_HOST=localhost

Upvotes: 3

Sehdev
Sehdev

Reputation: 5662

DB_HOST should be IP Address only

Change

DB_HOST=http://45.77.34.158/phpmyadmin

to

DB_HOST=45.77.34.158

if that doesn't work then run this command this will help you to clear cached config

php artisan cache:clear

Upvotes: 12

Lalit Kumar
Lalit Kumar

Reputation: 360

DB_CONNECTION=mysql
DB_HOST=45.77.34.158
DB_PORT=3306
DB_DATABASE=dataname
DB_USERNAME=user
DB_PASSWORD=12345679

Upvotes: 3

helderneves91
helderneves91

Reputation: 975

the host should not be an URL, instead use only the IP ADDRESS.

DB_HOST=45.77.34.158

Upvotes: 4

Related Questions