Microsoft SQL Server Native Client 10.0登录超时已过期

时间:2022-11-23 13:17:26

I have a freshly installed SQL Server 2008 R2 Express. I'm trying to run SQLCMD locally (please do take note locally) but I am receiving the error:

我有一个新安装的SQL Server 2008 R2 Express。我正在尝试在本地运行SQLCMD(请在本地注意)但我收到错误:

Named Pipes Provider: Could not open a connection to SQL Server [2]
Sqlcmd: Error: Microsoft SQL Serve Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more informations see SQL Server Books Online..
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0: Login timeout expired.

命名管道提供程序:无法打开与SQL Server的连接[2] Sqlcmd:错误:Microsoft SQL Serve Native Client 10.0:建立与SQL Server的连接时发生了与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。检查实例名称是否正确以及SQL Server是否配置为允许远程连接。有关更多信息,请参阅SQL Server联机丛书.. Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:登录超时已过期。

Why can't I make it work? I already tried everything.

为什么我不能让它运作?我已经尝试了一切。

6 个解决方案

#1


4  

Maybe a little late on the draw here but for future readers with the issue: Try running Command Prompt as Administrator.

也许这里的抽奖时间有点晚,但对于未来的读者而言:尝试以管理员身份运行命令提示符。

#2


3  

I ran into the same problem. I used -S, instead of -s, and removed the "" before and after the servername\instance. Everything ran great after that.

我遇到了同样的问题。我使用-S而不是-s,并在servername \ instance之前和之后删除了“”。之后一切都很顺利。

#3


2  

In the named pipes properties just change the path to \\.\pipe\sql\query instead of default path

在命名管道属性中,只需将路径更改为\\。\ pipe \ sql \ query而不是默认路径

#4


1  

I had this same thing happen to me for a client trying to setup a new SQL-Server box.

对于尝试设置新的SQL-Server盒的客户端,我遇到了同样的事情。

Open your SQL-Server configuration manager on the machine where SQL is actually INSTALLED.

在SQL实际安装的计算机上打开SQL-Server配置管理器。

Look to the SQL Native Client 10.0 Configuration. Under that is Client Protocols. You probably have TCP/IP and Named Pipes DISABLED. You need to ENABLE them.

查看SQL Native Client 10.0配置。在那下面是客户端协议。您可能已禁用TCP / IP和命名管道。你需要启用它们。

Microsoft SQL Server Native Client 10.0登录超时已过期

#5


0  

This seems to happen too when the server or the instance can't be found.

当无法找到服务器或实例时,这似乎也会发生。

It will eventually close with the reason (the first part of the error may be what misguided you):

它最终会因为原因而关闭(错误的第一部分可能是误导你的):

Sqlcmd: Error: ... : Login timeout expired.

Sqlcmd:错误:...:登录超时已过期。

Sqlcmd: Error: ... : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.

Sqlcmd:错误:...:建立与SQL Server的连接时发生了与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。检查实例名称是否正确以及SQL Server是否配置为允许远程连接。

So:

所以:

  • Check the server name is correct;
  • 检查服务器名称是否正确;
  • Check the instance name is correct (and if you didn't mean to use the default instance, try remove the instance name completely);
  • 检查实例名称是否正确(如果您不打算使用默认实例,请尝试完全删除实例名称);
  • Check if the server can be reached using ping, etc.
  • 检查是否可以使用ping等来访问服务器。

#6


0  

I had the same issue, the reason is because sqlcmd when typed alone without the servername, tries to connect to the default server. If you have named instance then it cannot connect to it without specifying the instance name. Work around is to make the named instance as default by changing the port as shown in this link: SQL Server, convert a named instance to default instance?

我有同样的问题,原因是因为sqlcmd在没有servername的情况下单独输入时,会尝试连接到默认服务器。如果您已命名实例,则在未指定实例名称的情况下无法连接到该实例。解决方法是通过更改此链接中显示的端口使命名实例成为默认实例:SQL Server,将命名实例转换为默认实例?

#1


4  

Maybe a little late on the draw here but for future readers with the issue: Try running Command Prompt as Administrator.

也许这里的抽奖时间有点晚,但对于未来的读者而言:尝试以管理员身份运行命令提示符。

#2


3  

I ran into the same problem. I used -S, instead of -s, and removed the "" before and after the servername\instance. Everything ran great after that.

我遇到了同样的问题。我使用-S而不是-s,并在servername \ instance之前和之后删除了“”。之后一切都很顺利。

#3


2  

In the named pipes properties just change the path to \\.\pipe\sql\query instead of default path

在命名管道属性中,只需将路径更改为\\。\ pipe \ sql \ query而不是默认路径

#4


1  

I had this same thing happen to me for a client trying to setup a new SQL-Server box.

对于尝试设置新的SQL-Server盒的客户端,我遇到了同样的事情。

Open your SQL-Server configuration manager on the machine where SQL is actually INSTALLED.

在SQL实际安装的计算机上打开SQL-Server配置管理器。

Look to the SQL Native Client 10.0 Configuration. Under that is Client Protocols. You probably have TCP/IP and Named Pipes DISABLED. You need to ENABLE them.

查看SQL Native Client 10.0配置。在那下面是客户端协议。您可能已禁用TCP / IP和命名管道。你需要启用它们。

Microsoft SQL Server Native Client 10.0登录超时已过期

#5


0  

This seems to happen too when the server or the instance can't be found.

当无法找到服务器或实例时,这似乎也会发生。

It will eventually close with the reason (the first part of the error may be what misguided you):

它最终会因为原因而关闭(错误的第一部分可能是误导你的):

Sqlcmd: Error: ... : Login timeout expired.

Sqlcmd:错误:...:登录超时已过期。

Sqlcmd: Error: ... : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.

Sqlcmd:错误:...:建立与SQL Server的连接时发生了与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。检查实例名称是否正确以及SQL Server是否配置为允许远程连接。

So:

所以:

  • Check the server name is correct;
  • 检查服务器名称是否正确;
  • Check the instance name is correct (and if you didn't mean to use the default instance, try remove the instance name completely);
  • 检查实例名称是否正确(如果您不打算使用默认实例,请尝试完全删除实例名称);
  • Check if the server can be reached using ping, etc.
  • 检查是否可以使用ping等来访问服务器。

#6


0  

I had the same issue, the reason is because sqlcmd when typed alone without the servername, tries to connect to the default server. If you have named instance then it cannot connect to it without specifying the instance name. Work around is to make the named instance as default by changing the port as shown in this link: SQL Server, convert a named instance to default instance?

我有同样的问题,原因是因为sqlcmd在没有servername的情况下单独输入时,会尝试连接到默认服务器。如果您已命名实例,则在未指定实例名称的情况下无法连接到该实例。解决方法是通过更改此链接中显示的端口使命名实例成为默认实例:SQL Server,将命名实例转换为默认实例?