0

I'm trying to connect to a local SQL Server instance on my computer using Microsoft SQL Server Management Studio, but I'm getting the following error:

"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections."

I have checked that the instance name is correct and that SQL Server is configured to allow remote connections. I'm using the correct authentication method (Windows Authentication), and I have tried restarting the SQL Server service.

What else can I do to troubleshoot this issue and connect to the local SQL Server instance? enter image description here

please tell me how to connect SQL server to my computer for my first C# .NET framework project?

  • https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/resolve-connectivity-errors-overview https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/network-related-or-instance-specific-error-occurred-while-establishing-connection – Mitch Wheat Apr 09 '23 at 09:02
  • Have you tried `(localdb)\MSSQLLocalDB` as instance name ? – RezaNoei Apr 09 '23 at 09:39
  • Hi, run the following command `services.msc` on your terminal and locate the SQL Server Service and write down the instance name somewhere the use that to connect the database. – Son of Man Apr 09 '23 at 10:07
  • 2
    *"using Microsoft SQL Server Management Studio"*. So what has this got to do with C#? – jmcilhinney Apr 09 '23 at 10:44
  • 1
    How EXACTLY did you install SQL Server? Based on your screenshot, you must have installed a fully-featured edition, e.g. Developer, rather than Express or just LocalDB with Visual Studio, and you must have installed a default instance. If that's not what you did then that would explain why you can't connect to a default instance. – jmcilhinney Apr 09 '23 at 11:10
  • `local` is not valid, unless you have a machine called `local` which is unlikely. If it's a default instance on your own machine then you need `.` or `YourMachineName`. If it's a named instance such as `SQLEXPRESS` then you need `.\InstanceName` or `YourMachineName\InstanceName`. If it's LocalDb then as above. So what do you actually have? – Charlieface Apr 09 '23 at 11:32
  • Get a list of SQL Server instances on your machine : https://blog.sqlauthority.com/2016/11/12/sql-server-get-list-sql-server-instances-installed-machine/ – jdweng Apr 09 '23 at 11:40

0 Answers0