# 下载 Microsoft SQL Server Red Hat 存储库配置文件
[root@192 ~]# sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/c ... ql-server-2019.repo
# 通过yum 安装 SQL Server
[root@192 lnmp1.6]# yum install -y mssql-server
# 配置 Microsoft SQL Server[root@192 ~]
# sudo /opt/mssql/bin/mssql-conf setup
usermod: no changes
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
8) I bought a license through a retail sales channel and have a product key to enter.
选择 2 开发版
- # 查看是否安装成功
[root@192 ~]# systemctl status mssql-server
2. 安装图形化数据库操作软件 Azure Data Studio
[root@192 ~]# cd /usr/local/src
[root@192 src]# wget https://azuredatastudiobuilds.bl ... linux-1.13.0.tar.gz
[root@192 src]# tar -xvf ./azuredatastudio-linux-1.13.0.tar.gz -C /usr/local
[root@192 src]# cd ../
[root@192 local]# echo 'export PATH="$PATH:/usr/local/azuredatastudio-linux-x64"' >> ~/.bashrc
[root@192 local]# source ~/.bashrc
# 启动图形化数据库操作界面
[root@192 local]# azuredatastudio
# 配置非root用户使用
[root@192 local]# exit
[gjp@192 local]# echo 'export PATH="$PATH:/usr/local/azuredatastudio-linux-x64"' >> ~/.bashrc
[gjp@192 local]# source ~/.bashrc
[gjp@192 local]# azuredatastudio
3.启动并连接 Microsoft SQL Server 2019
添加软件源并安装依赖包
[root@localhost ~]# curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/msprod.repo
# yum -y install mssql-tools unixODBC-devel bzip2 gdb libsss_nss_idmap cyrus-sasl cyrus-sasl-gssapi添加命令行环境变量
- [root@localhost ~]# echo 'export PATH=$PATH:/opt/mssql-tools/bin' > /etc/profile.d/mssql.sh
[root@localhost ~]# source !$
source /etc/profile.d/mssql.sh
命令行测试
- [root@localhost ~]# sqlcmd -S localhost -U sa
Password:
# 显示系统数据库
1> select name,database_id from sys.databases;
# 执行
2> go
name database_id
-------------------------------------------------------------------------------------------------------------------------------- -----------
master 1
tempdb 2
model 3
msdb 4
(4 rows affected)
# 查看软件版本
1> SELECT @@VERSION
2> go
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2019 (RTM-CU1) (KB4527376) - 15.0.4003.23 (X64)
Dec 6 2019 14:53:33
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Linux (CentOS Linux 7 (Core))
(1 rows affected)
1>
|