I've just installed SQL Server 2008 and I cannot connect to it with SQL Server Management Studio. My intention is to just let my local windows user be authenticated but I am not totally sure how to do that.
In the connect dialog I'm writing:
Server type: Database Engine
Server name: (local)
Authentication: Windows Authentication
My first question would be if that is what I should connect to? When I try to connect I get this error message:
TITLE: Connect to Server
------------------------------
Cannot connect to (local).
------------------------------
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
I went to the URL there displayed and it just basically says "be sure SQL server is running". I think it is but I am not totally sure.
I've disabled the Windows Firewall (this is Windows 7 7100 x86). I've also changed the log on system in the SQL Server Configuration Manager but it seems it's not a problem of logging in but not even be able to open the socket to it. On that same tool I've enabled all the protocols on "SQL Server Network Configuration" -> "Protocols for SQLEXPRESS" with no luck. I run out of ideas. What else can I try?
Ok, can you open your services console and scroll down to S for SQL Server. You should now see the services. Please ensure SQL Server (SQLEXPRESS) is running and then try .\SQLEXPRESS instead of (local).
So as per your example:
Hope this helps
Update: These instructions are because I assume you are running Express Edition not Dev/Std/Ent edition of SQL Server
Try ensuring the appropriate protocols are enabled:
You should now be able to login to the instance
If you find you cannot login at all you may need to follow these instructions to get SQL Server into single user mode. See here for the full instructions from Microsoft.
You should now be able to login to the instance and add yourself to the security tab and grant full access.
Alternate Method:
THere is a script here that claims to add the current user to the SQL Server sysadmin role. This may work in single user mode but I have not verified it
(local) resolves to 127.0.0.1, and works for defaults only. Instances, like the default for SQL Server Express, need a real name. Note that you can check the error log for SQL Server (SQL install folder, then log) and one of the first few entries will give you the IP, port, and name of the instance.
So you could use those instead. Instance names are good to use, since they are fairly consistent. Note that they are also use dynamic ports, so it could be a different port on each restart. SQL Server configuration Manager can set a specific port. not sure about the Express tools.