centos8安装sqlserver2019

官方文档
1.下载 Microsoft SQL Server 2019 Red Hat 存储库配置文件

sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo

2.安装 SQL Server

sudo yum install -y mssql-server

3.运行 mssql-conf setup,按照提示选择版本并设置 SA 密码

sudo /opt/mssql/bin/mssql-conf setup

选择版本2

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.

 

 

重复输入两次相同的强策略密码 Enter the SQL Server system administrator password: Confirm the SQL Server system administrator password:

输入完毕后如果服务器内初小于2000M,则会报错

Configuring SQL Server... sqlservr: This program requires a machine with at least 2000 megabytes of memory. /opt/mssql/bin/sqlservr: This program requires a machine with at least 2000 megabytes of memory. Initial setup of Microsoft SQL Server failed. Please consult the ERRORLOG in /var/opt/mssql/log for more information.

 

解决方法-使用python2进行修改

要用python2,python3不行
python2 安装

dnf install python2

切换工作目录:

1

cd /opt/mssql/bin

备份原文件

1

cp sqlservr sqlservr.bak

重命名原文件

1

mv sqlservr sqlservr.old

使用python进行修改

1

python

  

1

2

3

4

= open("sqlservr.old""rb").read()

= a.replace("\x00\x94\x35\x77""\x00\x80\x84\x1e")

open("sqlservr""wb").write(b)

exit()

修改完后,设置权限

1

chmod 755 sqlservr

 

修改完成后再重新运行 mssql-conf setup,按照提示选择版本并设置 SA 密码

sudo /opt/mssql/bin/mssql-conf setup

配置完成后,查看服务是否启动成功

systemctl status mssql-server

 

安装 SQL Server 命令行工具

若要创建数据库,则需要使用可在 SQL Server 上运行 Transact-SQL 语句的工具进行连接。

1.下载 Microsoft Red Hat 存储库配置文件

sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo

2.如果安装了早期版本的 mssql-tools,请删除所有旧的 unixODBC 包

sudo yum remove unixODBC-utf16 unixODBC-utf16-devel

3.运行以下命令,以使用 unixODBC 开发人员包安装 mssql-tools。

sudo yum install -y mssql-tools unixODBC-devel

安装时,会出现以下提醒,输入YES即可继续

The license terms for this product can be downloaded from https://aka.ms/odbc17eula and found in /usr/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES', you indicate that you accept the license terms. Do you accept the license terms? (Enter YES or NO)

4.向 PATH 环境变量添加 /opt/mssql-tools/bin/

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 '<YourPassword>'

本地操作可在此处进行查看
其余配置可通过此文档进行查看

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值