无法连接到 SQL Server 2014 Express [英] Can't connect to SQL Server 2014 Express

查看:127
本文介绍了无法连接到 SQL Server 2014 Express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法连接到新安装的 SQL Server 2014 Express 实例.我什至不完全确定你需要什么信息来帮助,所以请耐心等待,因为我是一个非常业余的人.如果我能提供更多信息来提供帮助,我会很乐意提供.

I'm having trouble connecting to a freshly installed instance of SQL Server 2014 Express. I'm not even totally sure what information you would need to help, so please bear with me as I'm very much an amateur. If I can provide anymore information to help, I'd be glad to.

我得到的错误总是一样的,

The error I get is always the same,

发生与网络相关或特定于实例的错误建立与 SQL Server 的连接.未找到服务器或无法访问.验证实例名称是否正确并且SQL Server 配置为允许远程连接.(提供者:命名管道提供程序,错误:40 - 无法打开与 SQL Server 的连接)"

"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)"

当前运行 SQL Server 2014 Express 的服务器是 Windows Server 2008 R2,所有补丁均由 Microsoft 发出.这是我家里的个人服务器,所以我可以用它做任何需要做的事情来完成这项工作.

The server currently running SQL Server 2014 Express is Windows Server 2008 R2, with all patches sent out by Microsoft. This is a personal server at my home, so I can do whatever needs to be done with it to make this work.

为了连接,我尝试使用 Visual Studio Community 2013,以及 C# 和 PowerShell 中的 System.Data.SqlClient 命名空间.

To connect, I've tried using Visual Studio Community 2013, as well as the System.Data.SqlClient namespace in C# and in PowerShell.

我已经确定不是防火墙导致了问题.我正确设置了规则,当它仍然不起作用时,我完全关闭了防火墙.同样的问题,没有连接.

I've made sure it isn't the firewall causing the problem. I set the rules properly, and when it still didn't work, I turned the firewall off completely. Same issue, no connection.

以下是我在 .NET 中尝试过的一些连接字符串示例.我已经从这些字符串中删除了服务器、实例、用户 ID 和密码,并且我确定我有正确的

Here are a few examples of connection strings I've tried in .NET. I've removed the server, instance, userid, and password from these strings, and I'm sure I have those correct

Data Source=SERVERNAME\INSTANCENAME;Initial Catalog=Requests;Integrated Security=False;User ID=USERID;Password=PASSWORD

Data Source=SERVERNAME;Initial Catalog=Requests;Integrated Security=False;User ID=USERID;Password=PASSWORD

Server=SERVERNAME\INSTANCENAME; Database=DATABASE; User ID=USERID; Password=PASSWORD

Server=SERVERNAME; Database=DATABASE; User ID=USERID; Password=PASSWORD

如果有人有时间和耐心帮助新手解决这个问题,我将不胜感激.我正在使用此设置自学一些 SQL 和 ASP.NET MVC 5 开发,在家中拥有一个小型实验室会很棒.

If anyone has the time and patience to help a newbie sort this out, I'd really appreciate it. I'm using this setup to teach myself some SQL and ASP.NET MVC 5 development, and having a minilab at home would be awesome.

感谢您抽出宝贵时间.

推荐答案

首先,打开 services.msc 并向下滚动到 SQL Server,并确保其已启动.

First off, open services.msc and scroll down to SQL Server, and ensure its started.

如果它没有运行修改自动启动,然后启动它.

If its not running modify to start automatically, and then start it.

运行后,关闭服务面板,然后运行 ​​ssms.exe(管理工作室)并尝试连接到服务器名称: 或服务器名称:<代码> [没有<>].您还可以单击服务器名称"下拉列表,然后选择浏览"以查看您的实例是否在列表中 - 尽管我发现了这一点.

Once it's running, close services panel, and run ssms.exe (management studio) and try connecting to Server Name: <machinename> or Server Name: <machinename\sql2014> [no <>]. You can also click the Server Name drop down list, and select BROWSE to see if your instance is listed - although I find this hit and miss.

确认其处于活动状态并已连接后,请关注此msdn页面 并按照步骤启用 tcp/ip 连接.

Once you confirm its active and you are connected, follow this msdn page and follow the steps to enable tcp/ip connections.

从那里您应该获得更改连接字符串所需的详细信息.

From there you should have the details necessary to alter your connection string.

这篇关于无法连接到 SQL Server 2014 Express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆