安装 Microsoft SQL Express 2012 后,FreeTDS 无限期挂起

2021-09-10 00:00:00 tsql sql-server freetds

当我尝试连接到服务器时,FreeTDS 无限期挂起:

FreeTDS hangs indefinitely when I try to connect to a server:

C:\FreeTDS\bin>tsql -H localhost -p 1433
locale is "English_United States.1252"
locale charset is "CP1252"
using default charset "CP1252"

(nothing else is displayed, can only exit with ^C)

当我运行 tsql -S 时出现相同的行为.

Identical behaviour occurs when I run tsql -S <servername>.

我最近卸载了 Microsoft SQL Server Management Studio,然后安装了 Express 版.与 tsql -H localhost -p 1433 的连接在卸载/安装之前工作.

I recently uninstalled Microsoft SQL Server Management Studio, and then installed the Express edition. Connection with tsql -H localhost -p 1433 worked before the uninstall/install.

运行 tsql -C 产生:

Compile-time settings (established with the "configure" script)
                        Version: freetds v0.91.98
         freetds.conf directory: /mingw/etc
 MS db-lib source compatibility: no
    Sybase binary compatibility: no
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 7.0
                          iODBC: no
                       unixodbc: yes
          SSPI "trusted" logins: yes
                       Kerberos: yes (Heimdal 1.5.3)
                 SSL encryption: yes (OpenSSL 1.0.1e)

更多信息:

我正在运行以下 SQL 相关服务:

I have the folowing SQL-related services running:

  • SQL 全文过滤器守护程序启动器 (SQLEXPRESS)
  • SQL Server (SQLEXPRESS)
  • SQL Server 浏览器
  • SQL Server 报告服务 (SQLEXPRESS)
  • SQL Server VSS 编写器

我尝试重新安装 FreeTDS.

I have tried reinstalling FreeTDS.

我在 SQL Server 配置管理器中为 SQLEXPRESS 启用了 TCP/IP.

I have enabled TCP/IP for SQLEXPRESS in the Sql Server Configuration Manager.

推荐答案

tsql 命令挂起,因为服务器没有在默认端口上运行.我通过运行 C:\>netstat -na | 发现了这一点.找到1433",它在端口 1433 上没有显示正在侦听.

The tsql command was hanging because the server was not running on the default port. I found this out by running C:\>netstat -na | find "1433", which showed nothing LISTENING on port 1433.

我是这样解决问题的:

  1. 打开Sql Server 配置管理器"
  2. 转到SQL Server 网络配置 > SERVER 的协议"
  3. 右键单击TCP/IP",选择属性",转到IP 地址"选项卡
  4. 在IPAll"下将TCP Port"设置为所需的端口号
  5. 单击确定",然后重新启动 SQL Server 服务.

相关文章