简体   繁体   中英

Cannot connect to local SQL Server with Management Studio

I'm having an issue with SQL Server, I have 2005 installed on my desktop as well as having SQL Server Management Studio installed..

I've checked and can see "SQL Server (SQLEXPRESS)" started in services.

I've tried to connect to "Local" and "SQLEXPRESS" but both fail to connect.

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) (.Net SqlClient Data Provider)

Anything else I need to do to connect to it??


UPDATE

I seem to be getting a little further along now. Ive managed to connect to my server with SQL Server Management (FYI .\\SQLEXPRESS did the trick) but now im having a issue with my connection string in my web.config

Ive im going to connect to this local sql server using windows authentication how do i need to structure it??

Something like this?

<add name="BensBoxing" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=BritBoxing_Alpha;Integrated Security=False;User Instance=True" providerName="System.Data.SqlClient"/>

This produces a error about

Login failed for user ''.

Check the sql log in the LOG directory of your instance - see if anything is going on there. You'll need to stop the service to open the log - or restart and you can read the old one - named with .1 on the end.

With the error you're getting, you need to enable TCP/IP or Named pipes for named connections. Shared memory connection should work, but you seem to not be using that. Are you trying to connect through SSMS?

In my log I see entries like this...

Server local connection provider is ready to accept connection on [\\.\pipe\mssql$sqlexpress\sql\query ]

As the comments said, .\\SQLEXPRESS should work. Also worstationName\\SQLEXPRESS will work.

Same as matt said . The "SQL Server(SQLEXPRESS)" was stopped. Enabled it by opening Control Panel > Administrative Tools > Services, right-clicking on the "SQL Server(SQLEXPRESS)" service and selecting "Start" from the available options. Could connect fine after that.

I was having this problem on a Windows 7 (64 bit) after a power outage. The SQLEXPRESS service was not started even though is status was set to 'Automatic' and the mahine had been rebooted several times. Had to start the service manually.

试着看,如果服务“SQL Server(MSSQLSERVER)”它已经启动,这就解决了我的问题。

Open Sql server 2014 Configuration Manager.

Click Sql server services and start the sql server service if it is stopped

Then click Check SQL server Network Configuration for TCP/IP Enabled

then restart the sql server management studio (SSMS) and connect your local database engine

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