linux:centos7安装sqlserver
时间: 2023-12-13 14:33:04 浏览: 177
以下是在CentOS 7上安装SQL Server的步骤:
1. 添加Microsoft SQL Server存储库
```shell
curl https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo > /etc/yum.repos.d/mssql-server.repo
```
2. 安装SQL Server
```shell
sudo yum install -y mssql-server
```
3. 运行安装向导
```shell
sudo /opt/mssql/bin/mssql-conf setup
```
4. 启动SQL Server服务
```shell
systemctl start mssql-server.service
```
5. 检查SQL Server服务状态
```shell
systemctl status mssql-server.service
```
6. 安装SQL Server命令行工具
```shell
sudo yum install -y mssql-tools unixODBC-devel
```
7. 将SQL Server命令行工具添加到PATH环境变量中
```shell
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
```
8. 连接到SQL Server
```shell
sqlcmd -S localhost -U SA -P '<YourPassword>'
```
阅读全文