在Linux操作系统中安装SQL Server tools

本文基于微软官方文档整理完成

https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-tools

The following steps install the command-line tools, Microsoft ODBC drivers, and their dependencies. The mssql-tools package contains:

  • sqlcmd: Command-line query utility.
  • bcp: Bulk import-export utility.

Install the tools for your platform:

Install tools on RHEL

Use the following steps to install the mssql-tools on Red Hat Enterprise Linux.

  1. Enter superuser mode.

    Copy

    bash

    sudo su
    
  2. Download the Microsoft Red Hat repository configuration file.

    Copy

    bash

    curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
    
  3. Exit superuser mode.

    Copy

    bash

    exit
    
  4. If you had a previous version of mssql-tools installed, remove any older unixODBC packages.

    Copy

    bash

    sudo yum update
    sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
    
  5. Run the following commands to install mssql-tools with the unixODBC developer package.

    Copy

    bash

    sudo yum update
    sudo yum install mssql-tools unixODBC-devel
    

    Note

    To update to the latest version of mssql-tools run the following commands:

    Copy

    bash

      sudo yum check-update
      sudo yum update mssql-tools
    
  6. Optional: Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell.

    To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:

    Copy

    bash

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

    To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:

    Copy

    bash

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

转载于:https://my.oschina.net/chipo/blog/841486

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值