Linux安装sql server2022的流程步骤

安装必要的工具

sudo yum install -y wget curl

下载并导入 Microsoft GPG 密钥

sudo curl -s https://packages.microsoft.com/keys/microsoft.asc
sudo rpm --import microsoft.asc

image

注册 SQL Server 2022 存储库

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

image

更新包列表

sudo yum update -y

image

安装 SQL Server 2022

sudo yum install -y mssql-server

image

image

配置 SQL Server

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

启动 SQL Server 服务

sudo systemctl start mssql-server
sudo systemctl enable mssql-server

image

安装 SQL Server 命令行工具

sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
sudo yum install -y mssql-tools unixODBC-devel

将 sqlcmd 和 bcp 添加到 PATH 环境变量

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

使用 sqlcmd 连接到 SQL Server

sudo /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd'

posted @ 2024-12-18 23:52  似梦亦非梦  阅读(33)  评论(0编辑  收藏  举报