Member-only story
So you’ve followed along the docs to install MSSQL server 2019 on ubuntu 18.04 and you’ve encountered the following 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.
well, let’s get that fixed right away!
Reason Why it’s Not Working
TL;DR; SQL Server 2017/2019 have a dependency on OpenSSL v1.0, while Ubuntu 18.04 comes with v1.1
Step 1 — Stop SQL Server
sudo systemctl stop mssql-server
Step 2 — Configuration
sudo systemctl edit mssql-server
then add the following line
[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"
save and exit
Step 3 — Link OpenSSL
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.sosudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so
Step 4-Start SQL Server
sudo systemctl start mssql-server
Now you should be able to login using
sqlcmd -S 127.0.0.1 -U SA