How to Fix SQL Server Error 10061 (Msg 10061)
You get sql server error 10061 when the target host refuses your TCP request. To fix it, start the database engine, check the port, and open the firewall. This failure means your client found the server IP address on the network. Still, nothing on that host accepted the request on the target port. Teams often hit this wall during app setups or after host reboots. You can fix the issue fast by checking each link in the network path. What causes sql server error 10061 on the network The databa
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get sql server error 10061 when the target host refuses your TCP request. To fix it, start the database engine, check the port, and open the firewall.
This failure means your client found the server IP address on the network. Still, nothing on that host accepted the request on the target port. Teams often hit this wall during app setups or after host reboots. You can fix the issue fast by checking each link in the network path.
What causes sql server error 10061 on the network
The database engine might be stopped or paused on the host machine. When the service is down, no process listens for incoming client traffic. The host operating system sees the packet and sends back a reset message.
Your database might also have TCP network protocols turned off in its setup. By default, some database installs only allow local connections on the same machine. Remote clients cannot reach the engine until you turn on network listening.
Port mismatches also trigger this exact error message for your team. Your client app might send traffic to one port while the server uses another. Named instances often use dynamic ports that change when the service restarts.
Finally, a host firewall or network rule might block the port actively. Instead of dropping the packet, the firewall rejects it right away. This active rejection tells your client that the target refused the request.
How to diagnose and fix the failure safely
First, log in to the database host and check the service state. If the engine is stopped, start it and check the error log. Look for startup failures like bad file paths or port conflicts.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Next, check that the database network protocol for TCP is active. Make sure the engine listens on the right network interface and IP address. Verify the exact port number assigned to your database instance.
If you use a named instance, check if the browser service is running. That helper service tells clients which dynamic port the instance uses today. Many teams set a static port instead to make firewall rules simpler.
Then, check the firewall rules on both the host and the network path. Allow inbound traffic only on the specific database port from trusted client IPs. Never turn off the entire firewall just to make the error go away.
Securing database roles after you restore access
Once the network path works, check how users log in to the database. A database user is the identity of a login when it connects. For many databases on one instance, a SQL user with a master login works well. For one or a few databases, a contained database user is an option. An admin must first enable contained databases on the server and database.
Do not grant broad owner rights just to avoid permission errors after fixing network issues. The owner role can do all maintenance tasks and can drop the database. Fixed database role permissions cannot be changed in SQL Server. Instead, use the data reader role so users only read user tables and views. If a user needs to change data, add the data writer role. You can also mask fields like emails, phone numbers, card numbers, or national IDs. Masking rewrites matched fields in results while keeping queries working for the team.
Add runtime guardrails beside SQL Server
Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.
With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.
Frequently asked questions
Does error 10061 mean my login password is wrong?
No, this error happens before the server checks your login or password. It means the TCP network request failed to reach an open database port. You will only see login errors after the TCP handshake succeeds.
Why does my app work on the server but fail from my laptop?
Local apps often use shared memory instead of TCP to talk to the database. Remote laptops must use TCP over the network to reach the host. Check that TCP is enabled and that the host firewall allows your IP.
Should I open all ports to fix dynamic port issues?
No, opening all ports creates a huge security risk for your host. Instead, assign a single static port to the database instance in your setup. Then open only that specific port in your firewall for trusted sources.
Related guides
In this post