Help : What’s my SQL Server Name?
Posted by blakhani on June 19, 2011
“What’s in a name? That which we call a rose by any other name would smell as sweet.” – William Shakespeare
Well, SQL Server connectivity did not know about Shakespeare While working on the forum, one of the most common error posted is below:
TITLE: Connect to Server
——————————
Cannot connect to <Shakespeare>.
——————————
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: -1)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
——————————
BUTTONS:
OK
——————————
Let’s look closely at the error message.
1. The server was not found or was not accessible.
2. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
3. error: 26 – Error Locating Server/Instance Specified.
All of the above are shouting out loud that “Damn! you have given wrong name to connect”. If you have given right name then check if SQL is up and running and then whole troubleshooting starts. The purpose of this post is to help the beginners who don’t care about troubleshooting because they are Visual Studio developers and they are connecting to local SQL Express most of the time.
Okay my dear developers, don’t worry… take a deep breath and start…
To get the SQL Server Name, the first thing you need to do is to find the instance name. On a single machine you can install 16 instances of SQL Servers. Each would have some name. To find the instance name of a SQL Server instance, please follow the steps below:
- Open SQL Server Configuration Manager (SSCM) from Start – > All Programs -> Microsoft SQL Server 2005/2008/2008 R2 -> Configuration Tools.
- In the SSCM, click SQL Server Services under SQL Server Configuration Manager (Local), you could find list like SQL Server (InstanceName),
- The InstanceName is what we need to find, instance name. If you install multiple instances on the server, you will see more than one SQL Server (InstanceName) listed.
In above picture you can see two “SQL Server” in “Service Type” column. It means I have two instances of SQL Server. For default instance you would see Name as SQL Server (MSSQLServer). It means on my machine I have two “named” instances of SQL Server. Keep in mind that you can have only only default instance on a machine.
Okay great! Now you know that your machine has default instance or named instance. And if it’s named then you know its name. Correct? Now lets quickly see what name you should use to connect. Before that you need to find hostname or computer name. Go to Start > Run > cmd This would open command prompt. Type hostname and you should see your machine name as below.
Default Instance | Named Instance | Comments |
BLAKHANI | BLAKHANI\SQLEXPRESS BLAKHANI\SQL2K8R2 |
this would work from remote machine also. |
(LOCAL) | (LOCAL)\SQLEXPRESS (LOCAL)\SQL2K8R2 |
local only |
. | .\SQLEXPRESS .\SQL2K8R2 |
local only |
LOCALHOST | LOCALHOST\SQLEXPRESS LOCALHOST\SQL2K8R2 |
local only |
BLAKHANI.MYDOMAIN.COM | BLAKHANI.MYDOMAIN.COM\SQLEXPRESS BLAKHANI.MYDOMAIN.COM\SQL2K8R2 |
Remote connections should be allowed as mentioned in http://support.microsoft.com/kb/914277 (
How to configure SQL Server 2005 to allow remote connections) |
TCP:221.222.223.224,1433 | TCP:221.222.223.224,9999 | IP and Port can be found by reading ERRORLOG of SQL Server. |
If you don’t see configuration manager then you can also get the instance name from services applet. To do this, go to Start > Run > Services.msc
Here is what i see on my screen
Hope this would help someone in the world!
Cheers,
Balmukund Lakhani
Twitter @blakhani
DEsipm said
there is the photo of my old and new Database when i start working on it.
https://skydrive.live.com/redir.aspx?cid=cdc59b233f2acd53&resid=CDC59B233F2ACD53!179
plz have a look and tell me what do i lack…
best regards
Help : Where is SQL Server ErrorLog? « Help: SQL Server said
[…] Connect to SQL Server using SQL Server Management Studio by providing correct name. To find the name to connect, refer my earlier post […]
Help : Where is SQL Server ErrorLog? - Balmukund Lakhani's Blog said
[…] Connect to SQL Server using SQL Server Management Studio by providing correct name. To find the name to connect, refer my earlier post […]
Alvaro Trettin said
I gotta bookmark this website it seems very helpful, invaluable
Step by Step: Installing SQL Server 2012 RC 0 « Help: SQL Server said
[…] I am going with default instance. For more details about the impact of that, please refer my earlier blog https://sqlserver-help.com/2011/06/19/help-whats-my-sql-server-name/ […]
marketing said
So Great! I need some infos in this submit for my rapport de stage. Can i have your contact please? I need your permission to quote it :D. Anyway, Thats great job. Maintain going.,
John L. Maboko said
You literally saved my day dude!
Eshan said
After going through all these steps i am getting the same error
Help : I lost sa password and no one has System Administrator (SysAdmin) permission. What should I do? « Help: SQL Server said
[…] Net Stop MSSQLServer (for default instance) / Net Step MSSQL$<InstanceName> If you want to know instance name, refer my earlier blog […]
pooja gupta said
actuly for connceting sql server i dont know the “sql server name” can u help it out.
HItesh Oza said
Dear All,
Open your visual studio… Create New Project for Windows or New Website…. then right click on your project in solution explorer and add > add Item > database (with .mdf)….. then database create and display in your solution explorer… then check the properties of your created database from Server Explorer… you can see the the CONNECTION STRING in properties… can get your SQL server name….
That’s it final solution in short way….
HITESH OZA
hiteshdoza@gmail.com
Ali Rizwan said
Thank You very much bro… problem solved
blakhani said
I am glad to hear that.
bharath said
when i open sq;service in configuration manager its empty, pls help me how to connect now
blakhani said
Do you have SQL Server installed? Go to Start>Run>Services and check if you have any SQL service installed.
sudhir said
what do you mean by he install only management studio but not sql server.
i install sql server 2008 express, but while connection showing error. after checking services in configuration manager right side pane is blank. wt does it mean???
blakhani said
Mostly the version of configuration manager would be lower than installed version. Open C:\Windows\System32 folder and do you see multiple files having name SQLServerManager*.msc (where * would be 10,11,12… etc.)?
Akash Aggarwal said
Are you online by any chance right now? I’m in deep shit and need your by tonight help connecting.. Tried everything, still can’t connect 😦 😦 😦
Akash Aggarwal said
Need your help connecting to my server by tonight***
Tam said
Thanks a lot
thara said
i did what you have post on your blog. but if there is same instance names, what should i do?
Mosses Jabakumar said
I have checked SQL instances are running and I have correct Server name, username and password but still I am not able to open SQL SERVER R2 management studio. Can any1 please help me out with this ..
Gay said
Awesome!
Prasun said
Thanx It Helped Me too much
meme said
hi, i want cmd but after i type hostname whats the next… pls. help me
blakhani said
You need to look at services.msc and find instance name.
nooshin.mehdikashi@yahoo.com said
Hi,
I cannot find the sql application in service.msc! it is not there! can you please help me?
blakhani said
That means SQL is not installed!
mgraves said
cheers dude, I was missing off LOCALHOST when trying to connect.
To Be….or not to Be….a sysadmin | What's Weird in SQL this week said
[…] Net Stop MSSQLServer (for default instance) / Net Step MSSQL$ If you want to know instance name, refer my earlier blog […]
ac said
Thank you! Putting in the instance from the Config Manager did the trick for me.
rony said
Balmukund Lakhani , Thank you so very much 🙂
Phathi said
I have SQL Server Management 2012 installed and I followed those steps to find the instance name by SQL Configure manager and I have instance names. What do I do
Phathi said
I have SQL Server Management 2012 installed and I followed those steps to find the instance name by SQL Configure manager and I have no instance names. What do I do
blakhani said
I think you only have management studio installed not SQL Database Engine.
Error : Your SQL Server installation is either corrupt or has been tampered with (Error getting instance ID from name.). Please uninstall then re-run setup to correct this problem « Help: SQL Server said
[…] If you get similar error, First make sure that instance name is correct. To know the instance name, refer my earlier blog What’s my SQL Server Name? […]
nim said
when I install visual studio 2013 , does sqlserver get installed along ?
blakhani said
I think you would get SQL Express edition.
Where is SQL Server ErrorLog? said
[…] Connect to SQL Server using SQL Server Management Studio by providing correct name. To find the name to connect, refer my earlier post […]
Ibrahem Shehata said
Thank u so much I installed more than one instance of SQL server and it wasn’t working but after u said look in services wow it’s working 🙂
M.Vijay said
How to detect server name?
blakhani said
I didn’t get the question.
savita gupta said
Please help me
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: 50 – Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)
blakhani said
That’s very generic error. are you using LocalDB?
swetha said
sql server services is showing empty plz help me..
JT said
This was helpful but my problem was SQLEXPRESS was not running. Once I right-clicked on “STOPPED” State and clicked “RUN”, it ran and I was then able to connect successfully.
sunil kumar said
how to delete database in visual studio 2013
using query
swetha said
sql server services is showing empty..plzz help me
chandramohanrawat63 said
sql server services is showing empty
Steven said
What do you enter as server name and password at SQL installation when it asks for credentials?
syamprasad said
thank u made my day
blakhani said
Thanks!
doanarae said
THANK YOU SO MUCH!!! IT WORKS!
mohit said
When i open my sql server configuration manager box and click sql server. It shows empty… plz tell me the solution i installed ms sql server yesterday qnd it show error while connecting..
blakhani said
Are you able to see SQL service in “Start > Run > Services.msc”
If yes then it could be a version issue. Make sure you are using right version of configuration manager.
Soham said
TITLE: Connect to Server
——————————
Cannot connect to .\SQLExpress.
——————————
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: -1)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
——————————
BUTTONS:
OK
——————————
Subba said
Thank you so much, great information
Atechie said
This worked! Thank you!