简体   繁体   English

无法使用Management Studio连接到本地SQL Server

[英]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.. 我遇到了SQL Server问题,我在桌面上安装了2005,并安装了SQL Server Management Studio。

I've checked and can see "SQL Server (SQLEXPRESS)" started in services. 我已经检查过并且可以在服务中看到“SQL Server(SQLEXPRESS)”。

I've tried to connect to "Local" and "SQLEXPRESS" but both fail to connect. 我试图连接到“Local”和“SQLEXPRESS”,但两者都无法连接。

A network-related or instance-specific error occurred while establishing a connection to SQL Server. 建立与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. 验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider) (提供程序:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)(。Net SqlClient数据提供程序)

Anything else I need to do to connect to it?? 还有什么我需要做的才能连接到它吗?


UPDATE 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 我设法通过SQL Server Management连接到我的服务器(FYI。\\ SQLEXPRESS做了诀窍)但现在我的web.config中的连接字符串出现了问题

Ive im going to connect to this local sql server using windows authentication how do i need to structure it?? 我即将使用Windows身份验证连接到本地SQL服务器如何构建它?

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. 检查实例的LOG目录中的sql日志 - 看看是否有任何进展。 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. 您需要停止服务以打开日志 - 或重新启动,您可以读取旧的 - 以最终命名为.1。

With the error you're getting, you need to enable TCP/IP or Named pipes for named connections. 由于您遇到错误,您需要为命名连接启用TCP / IP或命名管道。 Shared memory connection should work, but you seem to not be using that. 共享内存连接应该可以工作,但您似乎没有使用它。 Are you trying to connect through SSMS? 您是否尝试通过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. 正如评论所说,。\\ SQLEXPRESS应该可行。 Also worstationName\\SQLEXPRESS will work. 还有worstationName \\ SQLEXPRESS会起作用。

Same as matt said . 亚马说的相同。 The "SQL Server(SQLEXPRESS)" was stopped. “SQL Server(SQLEXPRESS)”已停止。 Enabled it by opening Control Panel > Administrative Tools > Services, right-clicking on the "SQL Server(SQLEXPRESS)" service and selecting "Start" from the available options. 通过打开“控制面板”>“管理工具”>“服务”,右键单击“SQL Server(SQLEXPRESS)”服务并从可用选项中选择“开始”来启用它。 Could connect fine after that. 之后可以连接好。

I was having this problem on a Windows 7 (64 bit) after a power outage. 断电后我在Windows 7(64位)上出现此问题。 The SQLEXPRESS service was not started even though is status was set to 'Automatic' and the mahine had been rebooted several times. 即使状态设置为“自动”并且mahine已重新启动多次,SQLEXPRESS服务仍未启动。 Had to start the service manually. 不得不手动启动服务。

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

Open Sql server 2014 Configuration Manager. 打开Sql server 2014配置管理器。

Click Sql server services and start the sql server service if it is stopped 单击Sql server services并启动sql server服务(如果已停止)

Then click Check SQL server Network Configuration for TCP/IP Enabled 然后单击“检查SQL Server网络配置以启用TCP / IP”

then restart the sql server management studio (SSMS) and connect your local database engine 然后重新启动sql server management studio(SSMS)并连接本地数据库引擎

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM