PHP Laravel: No Connection Could Be Made Because the Target MAChine Actively Refused It

PHP Laravel: No connection could be made because the target machine actively refused it

I changed the ip address specified in the homestead.yaml from localhost to 192.168.10.10. Then I ran homestead provision and that seemed to fix the problem. The host machine cannot resolve localhost or 127.0.0.1 because that is already mapped to itself.

SQLSTATE[HY000] [2002] No Connection Could Be Made

change port to DB_PORT=3306 the
run the following commands

1.php artisan config:clear

2.php artisan cache:clear

No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6037]

The redis server was not started and the port number was wrong in my env file

Laravel: SQLSTATE HY000 2002 No connection could be made because the target machine actively refused it

Use these default settings in your .env file:

DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

Also, be sure homestead database is created.

The thing is .env settings override database.php ones.

Documentation

Email verification. No connection could be made because the target machine actively refused it

Solved it!

I just change the port and encryption

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=e9a7e9d32adaf9
MAIL_PASSWORD=58b926579ce74d
MAIL_FROM_ADDRESS=from@example.com
MAIL_FROM_NAME=Example
MAIL_ENCRYPTION=tls

ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it

If the WAMP icon is Orange then one of the services has not started.

In your case it looks like MySQL has not started as you are getting the message that indicates there is no server running and therefore listening for requests.

Look at the mysql log and if that tells you nothing look at the Windows event log, in the Windows -> Applications section. Error messages in there are pretty good at identifying the cause of MySQL failing to start.

Sometimes this is caused by a my.ini file from another install being picked up by WAMPServers MySQL, normally in the \windows or \windows\system32 folders. Do a search for 'my.ini' and 'my.cnf' and if you find one of these anywhere outside of the \wamp.... folder structure then delete it, or at least rename it so it wont be found. Then restart the MySQL service.



Related Topics



Leave a reply



Submit