SYMPTOM
When attempting to connect to your SQL Server, you may get 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 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
CAUSES & RESOLUTIONS
This can be caused by several different things, but I'll go through a couple of the most common ones here.
- SQL Server Doesn't Allow Remote Connections - Make sure SQL Server is set up to allow remote connections. This is typically set when you are installing SQL Server, but can be fixed later if you didn't get it right during the install.
To check/set it: - In SQL Server Management Studio, right click on the Server node (it is the top most node in the tree on the left side).
- Choose Properties.
- On the Server Properties Dialog, click Connections.
- Make sure the Remote Connections checkbox is checked.
- Click OK to save. Restart the SQL Server Engine service for the changes to take effect. (see below for this)
- SQL Server Is Not in Mixed Authentication Mode - Make sure you can log in with both domain and regular SQL user accounts. Often companies forget to turn this on during the installation and SQL Server only allows domain Windows Authenticated logins.
To check/set it: - In SQL Server Management Studio, rightclick on the Server node (it is the top most node in the tree onthe left side).
- Choose Properties.
- On the Server Properties Dialog, click Security.
- Make sure SQL Server and Windows Authentication mode is checked under Server Authentication.
- Click OK to save. Restart the SQL Server Engine service for the changes to take effect. (see below for this)
- You are attempting to log in with a Windows user account - Make sure you log in with a SQL Server account and not a Windows Authenticated account. You will need the user id and password for the SQL Server account. See the article on creating a SQL Server account for information on how to correctly set up a SQL account.
- Your SQL Server or Instance name is not called out correctly - As of SQL 2005, you must refer to the SQL Server with both a server name (or IP address) and an instance name. If you are using SQL Server 2005 Express, the instance name is always "SQLExpress". The server name is always [server name]\[instance name] with a backslash between them. Examples: "MyServer\MyInstance", "34.23.122.10\myinstance" Make sure you have it set this way in the server box of the connection window. If you are on the same physical PC as the SQL Server, you can use "(local)" instead of the name/ip address and that will also work. Example: "(local)\SQLExpress"
NOTE: As of SQL 2008, it appears the instance identifier is no longer necessary.
- Your SQL Server is behind a firewall - If you are accessing your SQL Server over the internet, you will not be able to access it if it is within a firewall. Please check with your IT administrator to find out whether or not this is the case. Sometimes, there is a special port identifier that must be added to the name in order to access it remotely. Your IT administrator will be able to tell you this.
MORE INFORMATION
These are some of the more common issues. As we identify more issues, we'll add them to this list.