问题
I am trying to setup the ms-sql server in my linux by following the documentation https://docs.microsoft.com/pl-pl/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-2017
The SQL server status is Active(Running)
I am getting the following error while executing the command
sqlcmd -S localhost -U SA -P '<YourPassword>'
Error:
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.
I also tried by giving the command
sqlcmd -S 127.0.0.1 -U SA -P '<YourPassword>'
But the issue is not solved and the same error is getting displayed.
When I tried giving the wrong password also it displays the same error.
Kindly help me to come over this issue. Thanks in Advance !
回答1:
Reverting to 14.0.3192.2-2 helps.
But it's possible to solve the problem also using the method indicated by Ola774, not only in case of upgrade from Ubuntu 16.04 to 18.04, but on every installation of SQL Server 2017 on Ubuntu 18.04.
It seems that Microsoft now in cu16 messed up with their own patch for the ssl-version problems applied in cu10 (https://techcommunity.microsoft.com/t5/SQL-Server/Installing-SQL-Server-2017-for-Linux-on-Ubuntu-18-04-LTS/ba-p/385983). But linking the ssl 1.0.0 libraries works.
So just do the following:
Stop SQL Server
sudo systemctl stop mssql-serverOpen the editor for the service configuration by
sudo systemctl edit mssql-server
This will create an override for the original service config. It's correct that the override-file, or, more exactly "drop-in-file", is empty when used the first time.
In the editor, add the following lines to the file and save it:
[Service] Environment="LD_LIBRARY_PATH=/opt/mssql/lib"Create symbolic links to OpenSSL 1.0 for SQL Server to use:
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.soStart SQL Server
sudo systemctl start mssql-server
回答2:
sudo apt-get install mssql-server=14.0.3192.2-2
Reverting to this version worked for me.
My scenario was a fresh install (everything latest version) on Ubuntu Server 18.04.2 receiving the client connection error from sqlcmd:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746
回答3:
You can either roll back to the previous version with the command sudo apt-get install mssql-server=14.0.3192.2-2 or keep the new version by following MSSQL_Ubuntu's answer.
Also disable the updates on the mssql-server package:
sudo apt-mark hold mssql-server
This will not prevent you to update it manually when you wish so.
回答4:
Upgrade from Ubuntu 16.04 to 18.04 still results in some issues
A few systems may require version 1.0 of the OpenSSL libraries to connect to SQL Server. Using OpenSSL 1.0 can be done as follows:
Stop SQL Server sudo systemctl stop mssql-server Open the editor for the service configuration sudo systemctl edit mssql-server In the editor, add the following lines to the file and save it: [Service] Environment="LD_LIBRARY_PATH=/opt/mssql/lib" Create symbolic links to OpenSSL 1.0 for SQL Server to use sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so Start SQL Server sudo systemctl start mssql-server I hope this helps
回答5:
Same problem. It's awful because im in dev now and that "great" update just killing my working time.
Update: MS SQL version rollback helped me, but unfortunately I have to remove all my data. Thanks that it was my dev machine. All notes below tested on
ijin -> lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description: Linux Mint 19 Tara
Release: 19
Codename: tara
1) I've remover MS SQL and its data
sudo rm -rf /var/opt/mssql
sudo apt-get purge mssql-server mssql-tools
sudo apt-get autoremove
sudo apt-get autoclean
2) Check available versions of MS SQL in repository
ijin -> apt-cache policy mssql-server
3) Installed custom MS SQL
sudo apt-get install mssql-server=15.0.1600.8-1 mssql-tools
4) Setup
sudo /opt/mssql/bin/mssql-conf setup
5) Mem limit, server agent
sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true
sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 3072
4) Restart, status
sudo service mssql-server restart
sudo service mssql-server status
Probably there is some issues with interaction of openssl package and updated MS SQL, I can't find if it is true or not, but googled a few notes about it. So you can use
apt-cache policy openssl
sudo apt-get install openssl=<version>
openssl version
To change openssl version and try to connect.
回答6:
Updated SQL Server to the version 14.0.3223.3-15 (Ubuntu 18.04.2 LTS) today and got exactly the same issue for both local and remote connections. Rolling back to the previous version (14.0.3192.2-2 in my case) worked for me:
sudo apt-get install mssql-server=14.0.3192.2-2
List versions installed on your machine:
apt-cache policy mssql-server
回答7:
I had the very same issue from within a docker container, I had to downgrade msodbc, mssql-tools and lib ssl:
RUN ACCEPT_EULA=Y apt-get install msodbcsql17=17.3.1.1-1 mssql-tools=17.3.0.1-1 -y
RUN wget http://security.debian.org/debian-security/pool/updates/main/o/openssl1.0/libssl1.0.2_1.0.2s-1~deb9u1_amd64.deb \
&& dpkg -i libssl1.0.2_1.0.2s-1~deb9u1_amd64.deb
Now it works like a charm.
Just in case, older versions of ms odbc driver and tools can be found here: https://packages.microsoft.com/debian/9/prod/pool/main/m/
For openssl: http://security-cdn.debian.org/debian-security/pool/updates/main/o/openssl1.0/
回答8:
Please revert to older version.... and work thanks @Kurt Preston
sudo apt-get install mssql-server=14.0.3192.2-2
回答9:
after trying a few solution, I found this:
https://www.youtube.com/watch?v=mfLbCarRzpg
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so
sudo systemctl stop mssql-server
sudo systemctl edit mssql-server
add thoses lines:
[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"
then restart the server
sudo systemctl start mssql-server
回答10:
After 2 days working on this problem I've finally solved it! In my case, I am using Fedora 28, so for those using RHEL, I followed this tutorial:
Installing Microsoft SQL Server on Red Hat Enterprise Linux 8 Beta
So, are you using Python 3? Apparently, you need to switch to Python 2 before installing it, using the following code (I guess in Ubuntu would work as well):
sudo alternatives --config python
Create a repository from https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
Download it, then install it without resolving dependencies.
After that, you can run the setup for mssql-conf:
sudo /opt/mssql/bin/mssql-conf setup
And continue the Microsoft documentation tutorial from that step.
Microsoft Tutorial for installing SQL Server 2017 on RHEL
Microsoft Tutorial for installing SQL Server 2017 on Ubuntu
Note: I read in some forums that SQL Server 2019 may be causing that problem, so I recommend installing the 2017 version.
回答11:
I got the same issue.
My OS is Ubuntu 18.10
sudo apt-get install mssql-server=14.0.3192.2-2
Then, in my case, I could not enter my SQL server because I got the below message
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'sa'. Reason: Server is in script upgrade mode. Only administrator can connect at this time..
Then, I followed the ServerFault Answer
Each command took a process for a while in my case.
来源:https://stackoverflow.com/questions/57265913/error-tcp-provider-error-code-0x2746-during-the-sql-setup-in-linux-through-te