Reputation: 603
I ran php artisan serve
artisan command on a Laravel app, it runs on port 8000
. However, I get a MySQL error when hitting a table: No connection could be made because the target machine actively refused it
.
My .env
DB_HOST=locahost
DB_PORT=3306
Upvotes: 1
Views: 1060
Reputation: 2834
Sometimes this problem occurs because of cache
, run the below command and try to clean your configuration cache:
php artisan config:clear
And if your problem is not solved try to change your DB_HOST=localhost
in your .env
file to DB_HOST=127.0.0.1
.
Upvotes: 1