SQL server management studio local database connection error in windows 7

后端 未结 7 2139
长发绾君心
长发绾君心 2021-01-02 00:30

I\'m running SQL Server 2012 Management Studio Express in windows 7, i am having issues connecting to the local db. i tried all the above mentioned solutions, didnt work. pl

7条回答
  •  半阙折子戏
    2021-01-02 00:56

    Assuming you installed SQL Server and used the named instance SQLEXPRESS, your server name should be:

    .\SQLEXPRESS
    

    Or:

    127.0.0.1\SQLEXPRESS
    

    You can check the instance name (it may not be SQLEXPRESS) and that the server is running in the Start Menu at a path very similar to this (but it will vary by version):

    Start > Programs > Microsoft SQL Server > Configuration Tools >
       SQL Server Configuration Manager

    If it is currently stopped, you need to right-click and choose Start:

    enter image description here

    You should also right-click and ensure that Startup Mode is set to automatic (this is under Properties > Service).

    The error message seems to imply that the server is trying to use named pipes. While locally it should be able to use shared memory, you should next ensure that the SQL Server Browser service is running. You can do that in:

    Control Panel > Administrative Tools > Services

    enter image description here

    If it's not started, start it, and set its Start Mode to automatic. (As above, you can do both of these things from the right-click menu.)

    If you're still not getting anywhere, it's possible you installed SQL Server 2012 without manually adding your Windows account to the group of administrators. If this is the case, hopefully you set it to use mixed mode and you can connect as sa. Otherwise you will need to use a tool like PSExec.exe to run SSMS as NT AUTHORITY\SYSTEM:

    PsExec -s -i "C:\...path to ssms...\Ssms.exe"
    

    Whether you can connect as sa or you need to connect using PSExec, the next steps are:

    1. make sure your Windows account is a login under Server > Security > Logins. If it's not there, add it by right-clicking Logins > New Login.
    2. make sure that login is a member of the sysadmin fixed server role. If it's not, make sure it is under the Server Roles tab.

提交回复
热议问题