Linux上的SqlServer

时间:2018-04-09 20:26:38

标签: sql-server linux

我今天在linux上使用我的sql-server遇到了问题,我的dotnet app停止工作导致无法连接到localhost上的sql-server,但是我的生产数据库在azure上工作正常。

使用sqlcmd -S localhost,1433 -U SA -p或与数据库上的用户建立连接

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.

如果我使用sqlcmd连接我的生产数据库上的天蓝色工作OK 如果我使用sqlectron连接我的localhost数据库工作确定

我收到错误后连接

$ ss -atunp | grep 1433
tcp    LISTEN     0      128       *:1433                  *:*                  
tcp    TIME-WAIT  0      0      127.0.1.1:1433               127.0.0.1:42839              
tcp    LISTEN     0      128      :::1433                 :::*  

连接到sqlectron后

$ sudo ss -atunp | grep 1433
tcp    LISTEN     0      128       *:1433                  *:*                   users:(("sqlservr",pid=4312,fd=134))
tcp    ESTAB      0      0      127.0.0.1:51466              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=94))
tcp    ESTAB      0      0      127.0.0.1:51468              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=96))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51464               users:(("sqlservr",pid=4312,fd=142))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51468               users:(("sqlservr",pid=4312,fd=148))
tcp    ESTAB      0      0      127.0.0.1:51470              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=97))
tcp    ESTAB      0      0      127.0.0.1:51472              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=98))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51462               users:(("sqlservr",pid=4312,fd=85))
tcp    ESTAB      0      0      127.0.0.1:51462              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=87))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51466               users:(("sqlservr",pid=4312,fd=147))
tcp    TIME-WAIT  0      0      127.0.0.1:1433               127.0.0.1:53693              
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51470               users:(("sqlservr",pid=4312,fd=149))
tcp    ES -atunp | grep 1433
tcp    LISTEN     0      128       *:1433                  *:*                   users:(("sqlservr",pid=4312,fd=134))
tcp    ESTAB      0      0      127.0.0.1:51466              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=94))
tcp    ESTAB      0      0      127.0.0.1:51468              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=96))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51464               users:(("sqlservr",pid=4312,fd=142))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51468               users:(("sqlservr",pid=4312,fd=148))
tcp    ESTAB      0      0      127.0.0.1:51470              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=97))
tcp    ESTAB      0      0      127.0.0.1:51472              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=98))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51462               users:(("sqlservr",pid=4312,fd=85))
tcp    ESTAB      0      0      127.0.0.1:51462              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=87))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51466               users:(("sqlservr",pid=4312,fd=147))
tcp    TIME-WAIT  0      0      127.0.0.1:1433               127.0.0.1:53693              
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51470               users:(("sqlservr",pid=4312,fd=149))
tcp    ESTAB      0      0      127.0.0.1:1433               127.0.0.1:51472               users:(("sqlservr",pid=4312,fd=150))
tcp    ESTAB      0      0      127.0.0.1:51464              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=91))
tcp    LISTEN     0      128      :::1433                 :::*                   users:(("sqlservr",pid=4312,fd=128))
TAB      0      0      127.0.0.1:1433               127.0.0.1:51472               users:(("sqlservr",pid=4312,fd=150))
tcp    ESTAB      0      0      127.0.0.1:51464              127.0.0.1:1433                users:(("sqlectron",pid=4689,fd=91))
tcp    LISTEN     0      128      :::1433                 :::*                   users:(("sqlservr",pid=4312,fd=128))

我尝试完全卸载并安装,但没有成功。

服务器正在运行,

$ service mssql-server status
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-04-09 18:34:06 -03; 37min ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 683 (sqlservr)
    Tasks: 168
   Memory: 1.5G
      CPU: 56.406s
   CGroup: /system.slice/mssql-server.service
           ├─683 /opt/mssql/bin/sqlservr
           └─843 /opt/mssql/bin/sqlservr

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

我可以使用SqlElectron连接,但使用sqlcmd或dotnet程序编号

我的问题不在于SqlServer,在Linux上是libssl,如果我尝试使用SSL连接失败的SqlElectron连接。

0 个答案:

没有答案