Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL server management studio local database connection error in windows 7

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. please help. thanks in advance.

Installation url is here.

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) (Microsoft SQL Server, Error: -1)

For help, click MSDN link.

like image 968
Rakesh Avatar asked Aug 28 '12 17:08

Rakesh


1 Answers

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.
like image 152
Aaron Bertrand Avatar answered Nov 10 '22 13:11

Aaron Bertrand