centos 7.7 下安装 sql server 2019
# 下载 Microsoft SQL Server Red Hat 存储库配置文件
[root@192 ~]# sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 231 100 231 0 0 662 0 --:--:-- --:--:-- --:--:-- 663
# 通过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.
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409
Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.
Enter your edition(1-8):2
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409
Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.
Enter your edition(1-8): 2
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x409
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409
Do you accept the license terms? [Yes/No]:Yes
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
# 查看是否安装成功
[root@192 ~]# systemctl status mssql-server
# 修改默认端口
sudo /opt/mssql/bin/mssql-conf set network tcpport 5555
# 查看可用配置项
sudo /opt/mssql/bin/mssql-conf list
解决乱码问题
创建数据库时要加参数
“create database " + dbName + " COLLATE Chinese_PRC_CI_AS;”;
或者在SQL SERVER MANAGEMENT STUDIO中可视化创建时指定排序规则为Chinese_PRC_CI_AS
注意事项
1.内存必须大于2G.
2.选择Express版本对于小规模应用足够,它的限制是:数据库文件大小限制是10G,CPU限制4核以下