Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulRehman's avatar

SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.

Please tell me how to solve this problem i am connecting laravel 5.4 with sql server.After all the settings in config/database.php and .env.When i am writing this command php artisan migrate on cmd.it shows following error

SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.

0 likes
4 replies
Snapey's avatar

Check and double-check your credentials.

I'm concerned that you say you changed in database.php, you should not store any private credentials there.

You can check what credentials are in place in tinker with config('database')

1 like
AbdulRehman's avatar

issue resolved.I set the default connection to sqlsrv but i dont know why despite of this it was trying to connect with mysql.Then i remove mysql array in config/database file then it start working

Please or to participate in this conversation.