ubuntu下安装mssql(sqlserver)客户端及使用
1. 下載工具
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo apt-get install mssql-tools unixodbc-dev
2. 設置軟連接
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd
或
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp
3. 測試是否安裝成功
root@ubuntu:/opt/mssql-tools/bin# ./sqlcmd
Microsoft (R) SQL Server Command Line Tool
Version 17.4.0001.1 Linux
Copyright (c) 2012 Microsoft. All rights reserved.
usage: sqlcmd ? ? ? ? ? ?[-U login id] ? ? ? ? ?[-P password]
? [-S server or Dsn if -D is provided]?
? [-H hostname] ? ? ? ? ?[-E trusted connection]
? [-N Encrypt Connection][-C Trust Server Certificate]
? [-d use database name] [-l login timeout] ? ? [-t query timeout]
? [-h headers] ? ? ? ? ? [-s colseparator] ? ? ?[-w screen width]
? [-a packetsize] ? ? ? ?[-e echo input] ? ? ? ?[-I Enable Quoted Identifiers]
? [-c cmdend]
? [-q "cmdline query"] ? [-Q "cmdline query" and exit]
? [-m errorlevel] ? ? ? ?[-V severitylevel] ? ? [-W remove trailing spaces]
? [-u unicode output] ? ?[-r[0|1] msgs to stderr]
? [-i inputfile] ? ? ? ? [-o outputfile]
? [-k[1|2] remove[replace] control characters]
? [-y variable length type display width]
? [-Y fixed length type display width]
? [-p[1] print statistics[colon format]]
? [-R use client regional setting]
? [-K application intent]
? [-M multisubnet failover]
? [-b On error batch abort]
? [-D Dsn flag, indicate -S is Dsn]?
? [-X[1] disable commands, startup script, environment variables [and exit]]
? [-x disable variable substitution]
? [-? show syntax summary]
4. 連接服務器?
root@ubuntu:/opt/mssql-tools/bin# ./sqlcmd -S 192.168.32.171 -U sa
Password:
1>
總結
以上是生活随笔為你收集整理的ubuntu下安装mssql(sqlserver)客户端及使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python 获取(字典)字符串时间区间
- 下一篇: pip的升级(pip升级)