2
votes

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

I tried: + php artisan cache:clear + php artisan view:clear + php artisan key:generate + php artisan config:cache. I also restarted the server!

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. Thanks! https://diy.stackexchange.com

4

4 Answers

6
votes

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

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

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

DB_HOST=45.77.34.158
1
votes

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