简体   繁体   中英

How to connect to SQL Server using SQL Server Management Studio using Windows and SQL Authentication

I am new to SQL Server 2012. I have installed SQL Server 2012 on my local machine successfully. When I try to connect to it using Management Studio, I am getting errors. I am not able to connect using Windows Authentication or SQL Server Authentication. I didn't get any screen asking for username or password while installing SQL Server. What credentials should I use to connect via SQL Server Authentication. PFB screen shots of the errors for both modes:

Windows authentication:

loginscreen

SQL Server authentication:

loginscreen

Error message:

错误信息

Please help me resolve this error. I have been stuck for a week here.

First step: go to the Start Menu > All Programs > Microsoft SQL Server 2012 > Configuration Tools > SQL Server Configuration Manager.

You should see a screen something like this:

在此输入图像描述

You should see at least one entry named SQL Server (instance name) and it should be in the Running state.

NOTE: if there is no entry labeled SQL Server (....) , then you don't have SQL Server installed. Reinstall it.

If that entry is not in the Running state, then you just need to start it.

If that "instance name" is indeed SQLEXPRESS , then you should be able to connect to .\\SQLEXPRESS as your machine/instance name.

However, if that name is anything else , then:

  • if the "instance name" is MSSQLSERVER (as in my screenshot), then you have an unnamed default instance - connect to it using . (just a dot), or (local) ( with the parenthesis!)
  • if the "instance name" is anything else than that, connect to it using .\\instance or (local)\\instance - just use dot or (local) to denote the local machine, and then a backslash and the instance name that you find in the screen

Are you sure you are connecting to SQL Express? .\\SQLEXPRESS should work on a local machine. You can try looking at Services on your machine and if you see SQL Server (MSSQLSERVER) among the services listed you have full SQL Server installed on your machine and you can connect to it using (local) and Windows Authentication. You were prompted during the install as to what account should be used for the Admin account and hopefully that is the account you are logged into windows as you try to login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM