Introduction
When we try to connect to the SQL Server, many times we get an Error as Provider: Named Pipes Provider, Error: 40 – could not open a connection to SQL server.
The reasons for getting this error are.
- This is due to a failure in connecting to the server instance we are using.
- The wrong default settings.
- SQL Server does not have permission to allow remote connection.
- Due to firewall settings.
Follow the below-given solutions to resolve these issues.
1. SQL Server instance is not running
Go to the Services option, and click on SQL Server installed in your system; I have an SQL Server instance installed with the name: MSSQLSERVER. If it is in not Started Status, then start it by right-clicking on it and clicking on the START option.

2. Make sure that TCP/IP is enabled
To make it enable, follow the steps: Click on Configuration Manager of SQL Server.

Now you can check the TCP/IP port status as Enabled or Disabled. You need to make it Enable and click on status to change port Properties.

Now fill Default Port no 1433 and click on the OK button.

3. Allow Remote Connections to be enabled under Connections in SQL Server Properties
Follow the below-given steps to enable it.
First, open SQL Management Studio, then right-click on the server name and click on the server Properties.

In the Server Properties under the Connections Options, you need to check the box Allow remote connections to this server and then click on the OK button.
4. Allow SQL Server in Firewall Settings
You need to add a Windows Firewall exception on the server for SQL TCP ports 1433 and 1434 so that SQL Server will run.
Go to Control Panel, then System and Security, or directly search it on your system as Windows Firewall. In this, click on Firewall. Here, you can see the Action tab as Allow for Firewall. You can change it through SQL Server Properties to allow or block it. As given in the below image.

Rushi MehtaPosted Nov 28, 2018, 6:17 AM
Nice Article
Sandip PatilPosted Jul 26, 2018, 3:04 AM
But every time getting the error server not found or not accessible. i call to the goddady team they told me that we are able to connect the db, change the isp, i also change the ISP, but getting the same error. even stop the Firewall, making the changes as per your requirement, but not able to connect. please suzzest me what should i do.?
Sandip PatilPosted Jul 26, 2018, 3:02 AM
Actaully I Need your Help. i am trying to connect my Local system SSMS to Godaddy DB.
Johan BarbozaPosted Jul 16, 2018, 12:35 PM
Excelent! Concise and precise. @Goutam Bharadwaj, check this link on section "To add a program exception to the firewall using Windows Firewall with Advanced Security": https://docs.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-2017
Ramakrishnan RamarPosted Jun 28, 2018, 10:06 AM
Thanks, You save my time.
Goutam BharadwajPosted Jun 11, 2018, 4:21 PM
Everything worked but I don't even find SQL server Management studio in the firewall itself please help me in this.
Nevin FradianPosted May 15, 2018, 2:13 AM
To resolve any kind of SQL server errors, one can download Kernel for SQL Recovery software, from- https://www.kerneldatarecovery.com/sql-recovery.html
Mohammed AshrafPosted May 11, 2016, 7:44 AM
Good one...
Thiruppathi RPosted May 11, 2016, 1:23 AM
Nice Share..
RakeshPosted May 10, 2016, 6:28 PM
Good share
Pankaj Kumar ChoudharyPosted May 10, 2016, 10:23 AM
Really Great Solution of this common error.......
Vignesh ManiPosted May 10, 2016, 8:31 AM
Nice
Sonu ChaudharyPosted May 10, 2016, 7:29 AM
good one
Hari ShankerPosted May 10, 2016, 5:15 AM
Very Nice Info..
Bhuvanesh MohankumarPosted May 10, 2016, 3:29 AM
Useful article, Thanks
Rohit PrakashPosted May 10, 2016, 3:19 AM
useful tips.......carry on