安装 MsSql
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ add-apt-repository "https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list"
$ apt-get update
$ apt-get install -y mssql-server
第一次设置 ( Sql Server 有8个版本可选择)
$ /opt/mssql/bin/mssql-conf setup
查看是否在运行
$ systemctl status mssql-server
安装 mssql-tools 和 unixodbc-dev
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"
$ apt-get update
$ 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
连接与创建数据库 (例子)
$ sqlcmd -S localhost -U SA -P '<password>'
1> CREATE DATABASE TestDB
2> GO
退出
1> QUIT
卸载
$ apt-get remove mssql-server
$ sudo rm -rf /var/opt/mssql/
没有评论:
发表评论