SQL Server Express 2012 错误:无法连接到本地数据库。

5
我已经安装了Sql Express 2012版本,我单独安装了Local Db。当我点击"已安装的Sql Server发现报告"时,我可以看到它已安装。但是,我无法使用Sql Server Management Studio或Microsoft Visual Studio 2012专业版连接它。我收到以下错误信息:
"The attempt to attach to the database failed with the following 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: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details."
在Windows事件查看器中,我看到了几个不同的注册表键名的错误。
"The DataDirectory registry value is missing in the LocalDb instance registry key:{-----}"

我检查了HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSQL Server Local DB中的注册表值,只有一个条目"已安装版本"。 我浏览了几篇帖子,这些帖子提供了解决以上错误的解决方案,我尝试了他们建议的几乎所有方法,但仍然无法让localDb正常工作。
如果有人能提供帮助以解决这个问题,我将不胜感激。
更新: 使用命令行界面,我验证了本地数据库v11.0已经安装。然而,命令sqlLocalDb info v11.0报错:"自动实例“v11.0”未创建。如果我尝试创建一个实例,则会出现另一个错误:“在localDb实例API方法调用内部发生意外错误。”

您可以尝试查看以下帖子:https://dev59.com/Cl4c5IYBdhLWcg3w-OU4#31383366 - G J
2个回答

0

您可以尝试使用SQL Server身份验证。同时确保您的SQL服务正在运行。

此外,您可以尝试删除以下注册表:

HKEY_USERS\.DEFAULT\Software\Microsoft\Microsoft SQL Server\UserInstances\[GUID_FROM_EVENT_LOG]

您也可以查看 使用 SQL Server 2012 Express LocalDB 入门


是的,SQL Server正在运行。 - AM0
HKEY_USERS.DEFAULT\Software\Microsoft 中没有 Microsoft SQL Server 的条目。我也可以在那里看到 Sql Server Management Studio。 - AM0
@user3088008:请检查我在答案中添加的链接! - Rahul Tripathi
还要检查这个:http://social.msdn.microsoft.com/Forums/sqlserver/en-US/0628296e-939a-4700-b498-1c3c9ce90597/a-networkrelated-or-instancespecific-error-occurred-while-establishing-a-connection-to-sql-server?forum=sqlsecurity - Rahul Tripathi
我已经安装了64位的SQL Express 2012版本。我也有VS 2012 Pro。这个问题出现在VS 2008和Sql Server 2008中。但是看起来与我的问题相似:http://blogs.msdn.com/b/sqlexpress/archive/2008/10/02/faq-error-creating-a-service-based-database-in-visual-studio-2008-sp1.aspx - AM0
显示剩余3条评论

0

您需要启动本地系统的SQL服务。

  1. 点击开始按钮
  2. 输入 "SQL Server Configuration Manager" 并单击它
  3. 打开 "SQL Server Configuration Manager" 后,您需要启动可能已停止的本地系统服务,这就是为什么您的本地数据库无法连接的原因。

启动本地服务后,您只需连接本地系统数据库即可成功连接。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接