Do this if your SQL Server randomly times out
Let’s say you’re running tests which connect to an instance of your SQL Server. All your tests fail because a connection timeout expired.
If this happens and you didn’t change anything, there’s no need to look elsewhere.
Go to Services via the menu or Windows + R and type services.msc.
Press Enter.
Locate the SQL Server (MSSQLSERVER) and restart the service.
This operation might take some time.
Have a nice cup of tea or coffee meanwhile.
However, if there’s a problem with restarting, you can try stopping and then starting it again. This should normally resolve the issue.
Apart from that, there’s little to no chance that an instance of the server is broken for no reason.
The most probable reason that this happens is when I restart my computer. Sometimes, for some reason, Windows cannot access the SQL Server service.
Now if the service is on the cloud or on another machine, then there might be a list of other issues.
Another blog post for that.