简体   繁体   English

如何在 ubuntu 16.04 中为 mssql 实例启用 TCP/IP?

[英]How to Enable TCP/IP for mssql instance in ubuntu 16.04?

I'm not able to connect SQL Server hosted in Ubuntu 16.04 using my program, I believe its because the TCP/IP is disabled for the instance I try to connect (Protocols for SQLEXPRESS under SQL Server network configuration).我无法使用我的程序连接托管在 Ubuntu 16.04 中的 SQL Server,我相信这是因为我尝试连接的实例禁用了 TCP/IP(SQL Server 网络配置下的 SQLEXPRESS 协议)。

How I'm sure because I tried to connect my program to SQL Server that hosted in Windows and it able to connect.我怎么确定是因为我试图将我的程序连接到 Windows 中托管的 SQL Server 并且它能够连接。

Example my instance name is SQLEXPRESS, so I'm trying to connect through SSMS by using IP Adress\\SQLEXPRESS and it fails.例如,我的实例名称是 SQLEXPRESS,因此我尝试使用 IP Adress\\SQLEXPRESS 通过 SSMS 进行连接,但它失败了。 But I am able to connect to the SQL if I use IP address only as the server name.但是如果我只使用 IP 地址作为服务器名称,我就可以连接到 SQL。

I tried to search about sqlcmd for enable the tcp/ip but all of them just show the guide to change the ports.我试图搜索有关 sqlcmd 以启用 tcp/ip,但所有这些都只显示更改端口的指南。

So, how can I enable tcp/ip connection for ip\\SQLEXPRESS instance in Ubuntu 16.04?那么,如何在 Ubuntu 16.04 中为 ip\\SQLEXPRESS 实例启用 tcp/ip 连接?

picture below just an example on enabling tcp/ip for the sql instance in windows下面的图片只是在 Windows 中为 sql 实例启用 tcp/ip 的示例

windows sql server 配置中的设置

I believe the reason why this doesn't work on linux is because it doesn't have a SQL Server Browser application that Windows has available.我相信这在 linux 上不起作用的原因是因为它没有 Windows 可用的 SQL Server Browser 应用程序。 This application redirects the requests to 1433 to whatever random port it's listening to currently -- this is why it will only connect when the port is specified.此应用程序将请求重定向到 1433 到它当前正在侦听的任何随机端口 - 这就是它仅在指定端口时才连接的原因。 In my case this stinks because I'm having to work around an ancient application that we don't have the source code for.就我而言,这很糟糕,因为我不得不处理一个我们没有源代码的古老应用程序。 I'm thinking about writing a little application that will redirect the default traffic to the correct port for linux msssql.我正在考虑编写一个小应用程序,它将默认流量重定向到 linux msssql 的正确端口。

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

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