简体   繁体   中英

Cannot connect anymore to local SQL Server 2008 database

Today I went to connect to my local database but I cannot connect anymore for unknown reasons. I typed in (local) and used Windows authentication like I always do yet I get this error.

Cannot connect to localhost.

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)

Is the SQL Server service running? To check, right-click on "My Computer" and choose "Manage..." From the tree on the left side of the window, choose "Services and Applications", then "Services". Look for the "SQL Server" service and see if it is in the "Started" status. If not, right-click on the service and choose "Start".

I just experienced the same problem. My database is stored on an external hard disk, unfortunately I plugged it in after I started the computer.

I had to restart the computer, to connect again successfully. A logout was not enough.

You may also want to check that the service is set to automatic start. this way when you reboot, you won't have to start the service...

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