下载
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
注册ubuntu存储库
安装add-apt-repository
sudo apt-get install software-properties-common
sudo apt-get update
注册ubuntu存储库
sudo add-apt-repository "$( wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list) "
更新包列表
apt-get update
安装
sudo apt-get install -y mssql-server
配置
sudo /opt/mssql/bin/mssql-conf setup
确认sqlserver运行
systemctl status mssql-server --no-pager
安装sqlserver工具
注册工具包
sudo add-apt-repository "$( curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list) "
更新包列表
sudo apt-get update
安装工具
sudo apt-get install -y mssql-tools unixodbc-dev
工具添加到环境变量
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
查看sqlserver是否运行
systemctl status mssql-server
修改排序规则
sudo /opt/mssql/bin/mssql-conf set-collation
启动服务
sudo systemctl start mssql-server
连接服务
sqlcmd -S localhost -U sa -P 'Pa$$w0rd'