SQL Server 2008 R2 cannot connect to a local database in Management Studio

I am using SQL Server 2008 R2 Express.

First I installed SQL Server 2008 R2 Express Management Studio, and then installed SQL Server 2008 R2 Express. I have an instance of SQLEXPRESS and it is set to automatic.

I am trying to connect to it locally using windows authentication. The server name is set to local, and the username is grayed out and set to my username.

When I try to connect, I get the following error:

enter image description here

Did I install the wrong SQL Server Management Studio?

+45
sql-server sql-server-2008-r2
Feb 16 '14 at 8:59
source share
10 answers

If your instance is called SQLEXPRESS , you need to use .\SQLEXPRESS or (local)\SQLEXPRESS or yourMachineName\SQLEXPRESS as the name of your server - if you have a named instance , you need to specify the instance name in the name of your server.

+82
Feb 16 '14 at 9:05
source share

You must also start the SQL Server Browser service. "

Go to Computer Management> Services. how to browse to computer management

Find find "SQL Server Browser"

  • set to
  • and also manually launch it (2)

how to edit sql server browser properties and start it

Hope this helps.

+61
Feb 16 '14 at 9:12
source share

Complete the following steps to connect to SQL Server 2008 r2 (Windows Authentication)

Step 1: Goto Control Panel โ†’ Administrator Tools โ†’ Services, select SQL SERVER (MSSQLSERVER) and double-click on it

Step 2: Click "Tools"

Step 3: Now log in to the SQL server with Windows authentication and use the username: (local)

Enjoy ...

+20
Oct. 25 '14 at 14:22
source share

I also got this error when the service stopped. Here is another way to start your service ...

  1. Find "Services" in the "Start" menu and click on it:

enter image description here

  1. Find the service for the instance you need and select it (shown below)
  2. Click start (shown below)

enter image description here

Note. As Kenan said, if the startup type of your services is not set to Automatic, you probably need to double-click the service and set it to Automatic.

+9
Mar 17 '16 at 17:48
source share

I know this problem can be solved by so many people, and many of them uninstalled and reinstalled the sql server to solve this problem. In my observation, the problem of not connecting the database service locally is just because of the network connection you are using, in most cases these problems occur when using a Wi-Fi network.

Solution : if you use wi-fi, then just right-click on the network status and get information about ip and enter the same ip in the sql server name, this will work. Regards Vishwajeet

+2
Jan 24 '15 at 8:28
source share

I have the same error, but with a different case. Let me give you a solution from here :

Fortunately, I also have the same setting on my desktop. I installed the first instance by default and then Sql Express. Everything is fine for me in a few days. Then I tried to connect as you are trying, i.e. with MachineName \ MsSqlServer for the default instance, and I received exctaly the same error.

So, the solution is when you try to connect to the default instance, you do not need to specify the instance name. (well this is something puzzled by me, why does it fail when we give the name of the instance, when is it the default instance? It's some kind of mistake, I don't know)

Just try it - PC-NAME and everything will be fine. PC-NAME is an MSSQLServer Instance.

Editing: after you read your question again, I realized that you are not knowing that MSSQLSERVER is the default instance of Sql Server. And to connect to the default instance (MSSQLSERVER) you do not need to specify the instance name in the connection string. "MachineName" in itself means "MachineName \ MSSQLSERVER".

+2
Dec 06 '16 at 14:10
source share

Many of the above helped me, plus the accepted answer, but since I was in an EC2 instance, I had no idea what my instance name was. Finally, I opened the SQLServer configuration manager and in the "Name" column, used everything that is as the connection server, so in my case. \ EC2SQLEXPRESS and works great!

enter image description here

+1
Jul 05 '16 at 19:01
source share

So, there may be various reasons for the behavior of Sql Server Management Studio (SSMS) described above:

1. It seems that if our SSMS did not open for a long time, the OS puts it into sleep mode. The solution is to manually activate our SQL server, as shown below:

  • Go to Computer Management -> Services and Applications -> Services. As you can see, the status of this service is currently empty, which means that it is stopped. enter image description here
  • Double-click the SQL Server option and a wizard window will appear, as shown below. Set the startup type to โ€œAutomaticโ€ and click on the โ€œStartโ€ button, which will start our SQL service. enter image description here enter image description here
  • Now check the status of your SQL Server. It will appear as "Running." enter image description here
  • You also need to make sure that other related services, which are also required for the full operation of our SQL Server, also work and work, such as the SQL Server browser, SQL Server agent, etc.

2. The second reason may be due to incorrect credentials. Therefore, enter the correct credentials.

3. If you have forgotten your credentials, follow these steps:

  • The first thing you can do is log in using "Windows Authentication" instead of "SQL Server Authentication". This will only work if you are logged in as an administrator.
  • The second case, what if you forget the name of the local server? No problem, just use the "." instead of your server name, and it should work. enter image description here

NOTE. This will only work for the local server and not for the remote server. To connect to a remote server, the IP address of the remote server is required.

0
Dec 10 '18 at 14:31
source share

I had this problem. My solution: change the same password of another in windowns. Reboot service (check the entry to the Service SQL tab).

-one
Jun 08 '14 at 5:17
source share

I had the same problem when connecting to Microsoft Sql Server Management Studio.

Microsoft Sql Server Management Studio - Error

Finally, I came up with a simple solution that made my life easier. I highly recommend this video if you are still experiencing a problem.

https://www.youtube.com/watch?v=4GfQk2117d4

-four
Jan 24 '16 at 10:13
source share



All Articles