In this section, we'll discuss how to solve SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it in laravel 10.
Example
If you got this error plz try to check your XAMPP connection is on if you connection is off then on MySQL also on Apache.
If this solution not work then try to use below method.
1. Change .env file from 127.0.0.1 to localhost fixed it.
2. Run laravel cofig cache command php artisan config:cache
3. Check your config/database.php to see anything change.